Logger-tt

Latest version: v1.7.3

Safety actively analyzes 681812 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.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 same `x` 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.

1.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.
* 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 the `TelegramHandler` for a usage sample.
* You can now set different log paths for different handlers by passing a dict to `setup_logging` (thank ZeroRin).

1.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 through `setup_logging` or log config file.

1.6.1

* Added `limit_line_length` parameter:
log only maximum `n` 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.

1.6.0

1. Exception on the multiline statement
From python 3.6 to 3.9, the `tokenize` 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.

2. Logging uncaught exception in child thread
Child thread is run in a `try-finally` by default, so it doesn't call `sys.excepthook` when an uncaught exception occurred.
So `logger-tt` doesn't receive the traceback to log it.
This release replaces the thread default `try-finally` to `try-except-finally` and `logger-tt` handles the uncaught exception normally.

Python 3.8+ has a new `thread.excepthook`. But since `logger-tt` has already handled the uncaught exception, this `thread.excepthook` won't be called.

1.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.

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.