I
I
iKreazy2021-06-15 19:40:47
Python
iKreazy, 2021-06-15 19:40:47

How not to output messages from loguru to the console?

from loguru import logger

logger.add("_main.log", format="<lvl>[</lvl><c>{time:DD.MM.YYYY HH:mm:ss.SSS}</c><lvl>]</lvl> <lvl>{message}</lvl>")

logger.debug('Error')
logger.info('Information message')
logger.log('Warning')

60c8d7cb8cb45505755241.png

How not to output these messages to the console? You only need to write to the file.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AWEme, 2021-06-15
@iKreazy

Remove the default logger before adding your own:

from loguru import logger
logger.remove()
logger.add(...)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question