Skip to content

Releases: Dragon2fly/logger_tt

Stable version v1.7.4

12 Feb 14:59
Compare
Choose a tag to compare
  • Fixed:

    • TelegramHandler re-grouped an already grouped message. Now messages are correctly grouped once.
    • Handlers from all loggers other than the root were mistakenly added to the root's handlers.
      This bug prevents the removal of handlers out of the root, thus the log message was doubled if another different handler was used. Now root's handlers are correctly added or removed (thank ZeroRin).
  • Usability:

    • Multiprocessing:
      • Changed the method of detecting child process, potentially fixing all issues related to multiprocessing and pyinstaller
      • logger's server port now automatically picks up a random available port instead of DEFAULT_TCP_LOGGING_PORT. This means in the case of running many multiprocessing applications at the same time, the user doesn't need to care about the port parameter anymore. Each application will pick its port, and its child processes will connect to the correct port, and thus log to the correct destination.
      • Added server_timeout argument to setup_logging(): allow the user to control how long should the log listener server
        wait before exiting following the death of the main thread.
      • Added client_only argument to setup_logging(): enable different independent applications to log to the same destination.
    • TelegramHandler: If the message is longer than 3072 characters, it will be split into parts and sent one by one.
      This is to avoid reaching the Telegram API's limit of 4096 characters per message, which users should rarely reach.
    • Format styles: added support for { (string.format) and $ (string.Template) formats. The same style could be used across fomatter's format and log message's format.

Stable version v1.7.3

05 Mar 04:13
Compare
Choose a tag to compare
  • 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.

Stable version v1.7.1

08 Jan 06:51
1080f81
Compare
Choose a tag to compare
  • 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).

Stable version v1.7.0

06 Mar 13:26
Compare
Choose a tag to compare
  • 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.

Stable version v1.6.1

19 Jun 10:12
Compare
Choose a tag to compare
  • 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.

Stable version v1.6.0

11 Jun 15:51
Compare
Choose a tag to compare
  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.

Stable version v1.5.2

09 Nov 07:39
Compare
Choose a tag to compare

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.