- Change the default log format to include the timezone offset since it produces less ambiguous logs (#856, thanks @tim-x-y-z).
- Add new
logger.reinstall()method to automatically set up theloggerin spawned child processes (#818, thanks @monchin). - Fix incorrect microsecond value when formatting the log timestamp using
{time:x}(#1440). - Fix hex color short code expansion (#1426, thanks @turkoid).
- Fix possible internal error when dealing with (rare) frame objects missing a
f_linenovalue (#1435). - Fix a regression preventing formatting of
record["time"]when usingzoneinfo.ZoneInfotimezones (#1260, thanks @bijlpieter). - Fix possible
ValueErrorraised on Windows when system clock was set far ahead in the future (#1291). - Fix externally raised
Exceptionpossibly causing invalid state generating repeatedRuntimeErrorof avoided deadlock (#1335). - Respect the
.levelattribute of standard loggingHandlerused as sink, which was previously ignored (#1409). - Allow the
rotationargument of file sinks to accept a list of rotation conditions, any of which can trigger the rotation (#1174, thanks @CollinHeist). - Honor the
NO_COLORenvironment variable which disables color output by default ifcolorizeis not provided (#1178). - Honor the
FORCE_COLORenvironment variable which enables color output by default ifcolorizeis not provided (#1305, thanks @nhurden). - Add requirement for
TERMenvironment variable not to be"dumb"to enable colorization (#1287, thanks @snosov1). - Make
logger.catch()usable as an asynchronous context manager (#1084). - Make
logger.catch()compatible with asynchronous generators (#1302). - Improve feedback for invalid format keys in logger format strings (#1450, thanks @Krishnachaitanyakc).
0.7.3 (2024-12-06)
- Fix Cython incompatibility caused by the absence of underlying stack frames, which resulted in a
ValueErrorduring logging (#88). - Fix possible
RuntimeErrorwhen removing all handlers withlogger.remove()due to thread-safety issue (#1183, thanks @jeremyk). - Fix
diagnose=Trueoption of exception formatting not working as expected with Python 3.13 (#1235, thanks @etianen). - Fix non-standard level names not fully compatible with
logging.Formatter()(#1231, thanks @yechielb2000). - Fix inability to display a literal
"\"immediately before color markups (#988). - Fix possible infinite recursion when an exception is raised from a
__repr__method decorated withlogger.catch()(#1044). - Improve performance of
datetimeformatting while logging messages (#1201, thanks @trim21). - Reduce startup time in the presence of installed but unused
IPythonthird-party library (#1001, thanks @zakstucke).
0.7.2 (2023-09-11)
- Add support for formatting of
ExceptionGrouperrors (#805). - Fix possible
RuntimeErrorwhen usingmultiprocessing.set_start_method()after importing thelogger(#974). - Fix formatting of possible
__notes__attached to anException(#980).
0.7.1 (2023-09-04)
- Add a new
contextoptional argument tologger.add()specifyingmultiprocessingcontext (like"spawn"or"fork") to be used internally instead of the default one (#851). - Add support for true colors on Windows using ANSI/VT console when available (#934, thanks @tunaflsh).
- Fix possible deadlock when calling
logger.complete()with concurrent logging of an asynchronous sink (#906). - Fix file possibly rotating too early or too late when re-starting an application around midnight (#894).
- Fix inverted
"<hide>"and"<strike>"color tags (#943, thanks @tunaflsh). - Fix possible untraceable errors raised when logging non-unpicklable
Exceptioninstances while usingenqueue=True(#329). - Fix possible errors raised when logging non-picklable
Exceptioninstances while usingenqueue=True(#342, thanks @ncoudene). - Fix missing seconds and microseconds when formatting timezone offset that requires such accuracy (#961).
- Raise
ValueErrorif an attempt to use nanosecond precision for time formatting is detected (#855).
0.7.0 (2023-04-10)
- Update
InterceptHandlerrecipe to make it compatible with Python 3.11 (#654). - Add a new
watchoptional argument to file sinks in order to automatically re-create possibly deleted or changed file (#471). - Make
patch()calls cumulative instead of overriding the possibly existing patching function (#462). - Make sinks added with
enqueue=Trueandcatch=Falsestill process logged messages in case of internal exception (#833). - Avoid possible deadlocks caused by re-using the logger inside a sink, a signal handler or a
__del__method. Since the logger is not re-entrant, such misuse will be detected and will now generate aRuntimeError(#712, thanks @jacksmith15). - Fix file sink rotation using an aware
datetime.timefor which the timezone was ignored (#697). - Fix logs colorization not automatically enabled for Jupyter Notebook and Google Colab (#494).
- Fix logs colorization not automatically enabled for Github Actions and others CI platforms (#604).
- Fix
logger.complete()possibly hanging forever whenenqueue=Trueandcatch=Falseif internal thread killed due toExceptionraised by sink (#647). - Fix incompatibility with
freezegunlibrary used to simulate time (#600). - Raise exception if
logger.catch()is used to wrap a class instead of a function to avoid unexpected behavior (#623).
0.6.0 (2022-01-29)
- Remove internal use of
pickle.loads()to fix the (finally rejected) security vulnerability referenced as CVE-2022-0329 (#563). - Modify coroutine sink to make it discard log messages when
loop=Noneand no event loop is running (due to internally usingasyncio.get_running_loop()in place ofasyncio.get_event_loop()). - Remove the possibility to add a coroutine sink with
enqueue=Trueifloop=Noneand no event loop is running. - Change default encoding of file sink to be
utf8instead oflocale.getpreferredencoding()(#339). - Prevent non-ascii characters to be escaped while logging JSON message with
serialize=True(#575, thanks @ponponon). - Fix
flake8errors and improve code readability (#353, thanks @AndrewYakimets).
0.5.3 (2020-09-20)
- Fix child process possibly hanging at exit while combining
enqueue=Truewith third party library likeuwsgi(#309, thanks @dstlmrk). - Fix possible exception during formatting of non-string messages (#331).
0.5.2 (2020-09-06)
- Fix
AttributeErrorwithin handlers usingserialize=Truewhen callinglogger.exception()outside of the context of an exception (#296). - Fix error while logging an exception containing a non-picklable
valueto a handler withenqueue=True(#298). - Add support for async callable classes (with
__call__method) used as sinks (#294, thanks @jessekrubin).
0.5.1 (2020-06-12)
- Modify the way the
extradict is used byLogRecordin order to prevent possibleKeyErrorwith standardlogginghandlers (#271). - Add a new
defaultoptional argument tologger.catch(), it should be the returned value by the decorated function in case an error occurred (#272). - Fix
ValueErrorwhen usingserialize=Truein combination withlogger.catch()orlogger.opt(record=True)due to circular reference of therecorddict (#286).
0.5.0 (2020-05-17)
- Remove the possibility to modify the severity
noof levels once they have been added in order to prevent surprising behavior (#209). - Add better support for "structured logging" by automatically adding
**kwargsto theextradict besides using these arguments to format the message. This behavior can be disabled by setting the new.opt(capture=False)parameter (#2). - Add a new
onerroroptional argument tologger.catch(), it should be a function which will be called when an exception occurs in order to customize error handling (#224). - Add a new
excludeoptional argument tologger.catch(), is should be a type of exception to be purposefully ignored and propagated to the caller without being logged (#248). - Modify
complete()to make it callable from non-asynchronous functions, it can thus be used ifenqueue=Trueto make sure all messages have been processed (#231). - Fix possible deadlocks on Linux when
multiprocessing.Process()collides withenqueue=Trueorthreading(#231). - Fix
compressionfunction not executable concurrently due to file renaming (to resolve conflicts) being performed after and not before it (#243). - Fix the filter function listing files for
retentionbeing too restrictive, it now matches files based on the pattern"root(.*).ext(.*)"(#229). - Fix the impossibility to
remove()a handler if an exception is raised while the sink'stop()function is called (#237). - Fix file sink left in an unstable state if an exception occurred during
retentionorcompressionprocess (#238). - Fix situation where changes made to
record["message"]were unexpectedly ignored whenopt(colors=True), causing "out-of-date"messageto be logged due to implementation details (#221). - Fix possible exception if a stream having an
isatty()method returningTruebut not being compatible withcoloramais used on Windows (#249). - Fix exceptions occurring in coroutine sinks never retrieved and hence causing warnings (#227).
0.4.1 (2020-01-19)
- Deprecate the
ansiparameter of.opt()in favor ofcolorswhich is a name more appropriate. - Prevent unrelated files and directories to be incorrectly collected thus causing errors during the
retentionprocess (#195, thanks @gazpachoking). - Strip color markups contained in
record["message"]when logging with.opt(ansi=True)instead of leaving them as is (#198). - Ignore color markups contained in
*argsand**kwargswhen 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).
0.4.0 (2019-12-02)
- Add support for coroutine functions used as sinks and add the new
logger.complete()asynchronous method toawaitthem (#171). - Add a way to filter logs using one level per module in the form of a
dictpassed to thefilterargument (#148). - Add type hints to annotate the public methods using a
.pyistub file (#162). - Add support for
copy.deepcopy()of theloggerallowing multiple independent loggers with separate set of handlers (#72). - Add the possibility to convert
datetimeto UTC before formatting (in logs and filenames) by adding"!UTC"at the end of the time format specifier (#128). - Add the level
nameas the first argument of namedtuple returned by the.level()method. - Remove
classobjects from the list of supported sinks and restrict usage of**kwargsin.add()to file sink only. User is in charge of instantiating sink and wrapping additional keyword arguments if needed, before passing it to the.add()method. - Rename the
logger.configure()keyword argumentpatchtopatcherso it better matches the signature oflogger.patch(). - Fix incompatibility with
multiprocessingon Windows by entirely refactoring the internal structure of theloggerso it can be inherited by child processes along with added handlers (#108). - Fix
AttributeErrorwhile using a file sink on some distributions (like Alpine Linux) missing theos.getxattrandos.setxattrfunctions (#158, thanks @joshgordon). - Fix values wrongly displayed for keyword arguments during exception formatting with
diagnose=True(#144). - Fix logging messages wrongly chopped off at the end while using standard
logging.Handlersinks with.opt(raw=True)(#136). - Fix potential errors during rotation if destination file exists due to large resolution clock on Windows (#179).
- Fix an error using a
filterfunction "by name" while receiving a log withrecord["name"]equals toNone. - Fix incorrect record displayed while handling errors (if
catch=True) occurring because of non-picklable objects (ifenqueue=True). - Prevent hypothetical
ImportErrorif a Python installation is missing the built-indistutilsmodule (#118). - Raise
TypeErrorinstead ofValueErrorwhen aloggermethod is called with argument of invalid type. - Raise
ValueErrorif the built-informat()andfilter()functions are respectively used asformatandfilterarguments of theadd()method. This helps the user to understand the problem, as such a mistake can quite easily occur (#177). - Remove inheritance of some record dict attributes to
str(for"level","file","thread"and"process"). - Give a name to the worker thread used when
enqueue=True(#174, thanks @t-mart).
0.3.2 (2019-07-21)
- Fix exception during import when executing Python with
-sand-Sflags causingsite.USER_SITEto be missing (#114).
0.3.1 (2019-07-13)
- Fix
retentionandrotationissues when file sink initialized withdelay=True(#113). - Fix
"sec"no longer recognized as a valid duration unit for filerotationandretentionarguments. - Ensure stack from the caller is displayed while formatting exception of a function decorated with
@logger.catchwhenbacktrace=False. - Modify datetime used to automatically rename conflicting file when rotating (it happens if file already exists because
"{time}"not presents in filename) so it's based on the file creation time rather than the current time.
0.3.0 (2019-06-29)
- Remove all dependencies previously needed by
loguru(on Windows platform, it solely remainscoloramaandwin32-setctime). - Add a new
logger.patch()method which can be used to modify the record dict on-the-fly before it's being sent to the handlers. - Modify behavior of sink option
backtraceso it only extends the stacktrace upward, the display of variables values is now controlled with the newdiagnoseargument (#49). - Change behavior of
rotationoption in file sinks: it is now based on the file creation time rather than the current time, note that proper support may differ depending on your platform (#58). - Raise errors on unknowns color tags rather than silently ignoring them (#57).
- Add the possibility to auto-close color tags by using
</>(e.g.<yellow>message</>). - Add coloration of exception traceback even if
diagnoseandbacktraceoptions areFalse. - Add a way to limit the depth of formatted exceptions traceback by setting the conventional
sys.tracebacklimitvariable (#77). - Add
__repr__value to theloggerfor convenient debugging (#84). - Remove colors tags mixing directives (e.g.
<red,blue>) for simplification. - Make the
record["exception"]attribute unpackable as a(type, value, traceback)tuple. - Fix error happening in some rare circumstances because
frame.f_globalsdict did not contain"__name__"key and hence prevented Loguru to retrieve the module's name. From now,record["name"]will be equal toNonein such case (#62). - Fix logging methods not being serializable with
pickleand hence raising exception while being passed to somemultiprocessingfunctions (#102). - Fix exception stack trace not colorizing source code lines on Windows.
- Fix possible
AttributeErrorwhile formatting exceptions within acelerytask (#52). - Fix
logger.catchdecorator not working with generator and coroutine functions (#75). - Fix
record["path"]case being normalized for no necessary reason (#85). - Fix some Windows terminal emulators (mintty) not correctly detected as supporting colors, causing ansi codes to be automatically stripped (#104).
- Fix handler added with
enqueue=Truestopping working if exception was raised in sink althoughcatch=True. - Fix thread-safety of
enable()anddisable()being called during logging. - Use Tox to run tests (#41).
0.2.5 (2019-01-20)
- Modify behavior of sink option
backtrace=Falseso it doesn't extend traceback upward automatically (#30). - Fix import error on some platforms using Python 3.5 with limited
localtime()support (#33). - Fix incorrect time formatting of locale month using
MMMandMMMMtokens (#34, thanks @nasyxx). - Fix race condition permitting writing on a stopped handler.
0.2.4 (2018-12-26)
- Fix adding handler while logging which was not thread-safe (#22).
0.2.3 (2018-12-16)
- Add support for PyPy.
- Add support for Python 3.5.
- Fix incompatibility with
awscliby downgrading requiredcoloramadependency version (#12).
0.2.2 (2018-12-12)
- Deprecate
logger.start()andlogger.stop()methods in favor oflogger.add()andlogger.remove()(#3). - Fix ignored formatting while using
logging.Handlersinks (#4). - Fix impossibility to set empty environment variable color on Windows (#7).
0.2.1 (2018-12-08)
- Fix typo preventing README to be correctly displayed on PyPI.
0.2.0 (2018-12-08)
- Remove the
parserand refactor it into thelogger.parse()method. - Remove the
notifierand its dependencies (pip install notifiersshould be used instead).
0.1.0 (2018-12-07)
- Add logger.
- Add notifier.
- Add parser.
0.0.1 (2017-09-04)
Initial release.