Python logging made (stupidly) simple
ExceptionGroup
errors (#805).RuntimeError
when using multiprocessing.set_start_method()
after importing the logger
(#974).__notes__
attached to an Exception
(#980).context
optional argument to logger.add()
specifying multiprocessing
context (like "spawn"
or "fork"
) to be used internally instead of the default one (#851).logger.complete()
with concurrent logging of an asynchronous sink (#906)."<hide>"
and "<strike>"
color tags (#943, thanks @tunaflsh).Exception
instances while using enqueue=True
(#329).Exception
instances while using enqueue=True
(#342, thanks @ncoudene).ValueError
if an attempt to use nanosecond precision for time formatting is detected (#855).InterceptHandler
recipe to make it compatible with Python 3.11 (#654).watch
optional argument to file sinks in order to automatically re-create possibly deleted or changed file (#471).patch()
calls cumulative instead of overriding the possibly existing patching function (#462).enqueue=True
and catch=False
still process logged messages in case of internal exception (#833).__del__
method. Since the logger is not re-entrant, such misuse will be detected and will now generate a RuntimeError
(#712, thanks @jacksmith15).datetime.time
for which the timezone was ignored (#697).logger.complete()
possibly hanging forever when enqueue=True
and catch=False
if internal thread killed due to Exception
raised by sink (#647).freezegun
library used to simulate time (#600).logger.catch()
is used to wrap a class instead of a function to avoid unexpected behavior (#623).pickle.loads()
considered as a security vulnerability referenced as CVE-2022-0329 (#563).loop=None
and no event loop is running (due to internally using asyncio.get_running_loop()
in place of asyncio.get_event_loop()
).enqueue=True
if loop=None
and no event loop is running.utf8
instead of locale.getpreferredencoding()
(#339).serialize=True
(#575, thanks @ponponon).flake8
errors and improve code readability (#353, thanks @AndrewYakimets).enqueue=True
with third party library like uwsgi
(#309, thanks @dstlmrk).AttributeError
within handlers using serialize=True
when calling logger.exception()
outside of the context of an exception (#296).value
to a handler with enqueue=True
(#298).__call__
method) used as sinks (#294, thanks @jessekrubin).extra
dict is used by LogRecord
in order to prevent possible KeyError
with standard logging
handlers (#271).default
optional argument to logger.catch()
, it should be the returned value by the decorated function in case an error occurred (#272).ValueError
when using serialize=True
in combination with logger.catch()
or logger.opt(record=True)
due to circular reference of the record
dict (#286).no
of levels once they have been added in order to prevent surprising behavior (#209).**kwargs
to the extra
dict besides using these arguments to format the message. This behavior can be disabled by setting the new .opt(capture=False)
parameter (#2).onerror
optional argument to logger.catch()
, it should be a function which will be called when an exception occurs in order to customize error handling (#224).exclude
optional argument to logger.catch()
, is should be a type of exception to be purposefully ignored and propagated to the caller without being logged (#248).complete()
to make it callable from non-asynchronous functions, it can thus be used if enqueue=True
to make sure all messages have been processed (#231).multiprocessing.Process()
collides with enqueue=True
or threading
(#231).compression
function not executable concurrently due to file renaming (to resolve conflicts) being performed after and not before it (#243).retention
being too restrictive, it now matches files based on the pattern "basename(.*).ext(.*)"
(#229).remove()
a handler if an exception is raised while the sink' stop()
function is called (#237).retention
or compression
process (#238).record["message"]
were unexpectedly ignored when opt(colors=True)
, causing "out-of-date" message
to be logged due to implementation details (#221).isatty()
method returning True
but not being compatible with colorama
is used on Windows (#249).ansi
parameter of .opt()
in favor of colors
which is a name more appropriate.retention
process (#195, thanks @gazpachoking).record["message"]
when logging with .opt(ansi=True)
instead of leaving them as is (#198).*args
and **kwargs
when logging with .opt(ansi=True)
, leave them as is instead of trying to use them to colorize the message which could cause undesirable errors (#197).