These are a lot of questions. I hope we're not off topic. I don't know if mine are best practices. I can tell what I try to do.
On Tue, 8 Feb 2022 at 15:15, Lars Liedtke <lied...@punkt.de> wrote: > - On a line per line basis? on a function/method basis? I usually log the start and end of functions. I could also log inside a branch or in other parts of the function/method. > - Do you use decorators to mark beginnings and ends of methods/functions > in log files? No, since I put the function parameters in the first log. But I think that such a decorator it's not bad. > - Which kind of variable contents do you write into your logfiles? Of > course you shouldn't leak secrets... Well, all the data that is useful to understand what the code is doing. It's better to repeat the essential data to identify a specific call in all the logs of the function, so if it is called simultaneously by more clients you can distinguish them > - How do you decide, which kind of log message goes into which level? It depends on the importance, the verbosity and the occurrences of the logs. > - How do you prevent logging cluttering your actual code? I have the opposite problem, I should log more. So I can't answer your question. -- https://mail.python.org/mailman/listinfo/python-list