Re: Custom logging function

2020-05-29 Thread zljubisic
Hi Peter. Finally I got it. :) That's it. It works. Thanks. So, in each class, I will in init method execute: self.logger = logging.getLogger() and than everywhere use self.logger.debug('...') in order to produce the message. Best regards. -- https://mail.python.org/mailman/listinfo/python-li

Re: Custom logging function

2020-05-28 Thread Peter Otten
zljubi...@gmail.com wrote: >> You create two stream handlers that both log to stderr -- one with >> basicConfig() and one explicitly in your code. That's probably not what >> you want. > > How can I just add terminator = '\r\n' to the code bellow? > Where should I put it? I already answered that

Re: Custom logging function

2020-05-27 Thread zljubisic
> You create two stream handlers that both log to stderr -- one with > basicConfig() and one explicitly in your code. That's probably not what you > want. How can I just add terminator = '\r\n' to the code bellow? Where should I put it? import logging LOG_LEVEL = logging.getLevelName('DEBUG')

Re: Custom logging function

2020-05-26 Thread Cameron Simpson
On 26May2020 13:25, zljubi...@gmail.com wrote: Furthermore, I must disable logging to stdout. Normally logging does not happen to stdout. Do you have something which does? Cheers, Cameron Simpson -- https://mail.python.org/mailman/listinfo/python-list

Re: Custom logging function

2020-05-26 Thread Peter Otten
zljubi...@gmail.com wrote: > Is this OK? > > import logging > > LOG_LEVEL = logging.getLevelName('DEBUG') > > logging.basicConfig(level=LOG_LEVEL, > format='%(asctime)s %(levelname)s %(name)s > %(funcName)-20s %(message)s', datefmt='%d.%m.%Y >

Re: Custom logging function

2020-05-26 Thread zljubisic
Furthermore, I must disable logging to stdout. -- https://mail.python.org/mailman/listinfo/python-list

Re: Custom logging function

2020-05-26 Thread zljubisic
Is this OK? import logging LOG_LEVEL = logging.getLevelName('DEBUG') logging.basicConfig(level=LOG_LEVEL, format='%(asctime)s %(levelname)s %(name)s %(funcName)-20s %(message)s', datefmt='%d.%m.%Y %H:%M:%S') stderr = logging.StreamHandler() stderr.termin

Re: Custom logging function

2020-05-26 Thread Peter Otten
zljubi...@gmail.com wrote: > Hi, > > I have a case in which I have to use custom function for logging. > For example, all messages should go to stderr and end with '\r\n'. > > Can I somehow use standard python logging module but send all message to > stderr with '\r\n' line endings? Isn't that

Re: Custom logging function

2020-05-25 Thread DL Neil via Python-list
On 26/05/20 8:26 AM, zljubi...@gmail.com wrote: Hi, I have a case in which I have to use custom function for logging. For example, all messages should go to stderr and end with '\r\n'. Can I somehow use standard python logging module but send all message to stderr with '\r\n' line endings?