import sys
from loguru import logger
logger.add(sys.stdout, colorize=True, format="{message}~~~~")
logger.debug("This is my logger\n awesome!! haha")
>> 2020-02-01 09:11:45.204 | DEBUG | __main__:<module>:1 - This is my logger
awesome!! haha
This is my logger
awesome!! haha~~~~
message alone but it always print 2020-02-01 09:11:45.204 | DEBUG | __main__:<module>:1... Why does it happen?
Hi @rightx2.
For convenience, a default sink logging to stderr is automatically attached to the imported logger. That's why you are seeing logs twice: messages are sent both to the default handler (stderr) and your customized handler (stdout).
If you want to get ride of it, you can just call logger.remove() at the start of your script (it will disable all previously added handlers). :+1:
@rightx2 Did the provided solution solved your issue?
@Delgan Yes. Thank you for a solution : )
Most helpful comment
@Delgan Yes. Thank you for a solution : )