Releases: Dragon2fly/logger_tt
Stable version v1.7.3
- Usability:
- Not to import custom handlers (StreamHandlerWithBuffer, TelegramHandler, etc) if they are not used in any logger.
- TelegramHandler:
- Better network error handling.
- Added
grouping_interval
to group many log messages that are within the samex
seconds interval into one before sending.
This reduces the number of times it sends messages to the Telegram server and helps to avoid Http-429 error.
Stable version v1.7.1
- Fixed: exception raised while handling another exception is now shown correctly (thank ZeroRin).
- New functionality:
- Added
TelegramHandler
. Now you can send logs directly to telegram users/groups. - Support Python 3.11
Fine-grained error locations
in tracebacks.
- Added
- Usability:
- Added level NOTICE = INFO + 5. You can do
logger.notice("your message")
. - Add set/remove
context injector
methods.
You can add additional information to the log record before it is actually handled.
Refer to theTelegramHandler
for a usage sample. - You can now set different log paths for different handlers by passing a dict to
setup_logging
(thank ZeroRin).
- Added level NOTICE = INFO + 5. You can do
Stable version v1.7.0
-
Fixed:
- multiprocessing: logfile rollover fails as the child process keeps opening the file.
- multiprocessing: if the log path is set by a variable with time,
the child process creates a new redundant log path.
-
New functionality: Added
StreamHandlerWithBuffer
. Buffer the log output by time or by line number.
GUI app could use this handler to keep the app responsive while having a tremendous log output. -
Usability: In multiprocessing logging,
users can set the log server address themselves throughsetup_logging
or log config file.
Stable version v1.6.1
-
Added
limit_line_length
parameter:
log only maximumn
characters for each traceback line. This prevents dumping the whole huge content of the variable into the log.n=1000
by default. -
Added
analyze_raise_statement
parameter:
logger-tt no longer analyzes the raise statement by default. This avoids logging value of variables on the raise statement two time, especially when the content of these variables are huge.
Stable version v1.6.0
-
Exception on the multiline statement
From python 3.6 to 3.9, thetokenize
module and the exception traceback have changed their behavior. So if a multiline statement raised an exception, the lines reported were different between different python versions. Sometimes, too many unrelated lines were reported too.- This release tries to mitigate that and grabs all the lines of the multiline statement as correctly as possible.
- If there are too many lines, it limits the line to be shown to 10.
-
Logging uncaught exception in child thread
Child thread is run in atry-finally
by default, so it doesn't callsys.excepthook
when an uncaught exception occurred.
Sologger-tt
doesn't receive the traceback to log it.
This release replaces the thread defaulttry-finally
totry-except-finally
andlogger-tt
handles the uncaught exception normally.Python 3.8+ has a new
thread.excepthook
. But sincelogger-tt
has already handled the uncaught exception, thisthread.excepthook
won't be called.
Stable version v1.5.2
The default logger named logger_tt
can be imported in all modules by from logger_tt import logger
.
This logger acts like regular loggers from logger = logging.getLogger(__name__)
,
but smart enough to inject threadName
, processName
if present.
This enables us to use one logger everywhere. Thus the code is even simpler.