Skip to main content

Loguru-based logger utilities with file and tracker handlers

Project description

new_logger

A small utility package that wraps Loguru with two pre-configured loggers and file handlers:

  • logger: console-bound logger (INFO+ to stderr by default) with optional rotating file handlers per level.
  • tracker_logger: silent console, writes tracker lines to a dedicated rotating file.

Installation

Build the wheel and install it into your environment:

python -m pip install --upgrade build wheel
python -m build
python -m pip install dist/new_logger-0.1.0-py3-none-any.whl

Usage

from new_logger import (
    logger,
    tracker_logger,
    add_file_handler_to_logger,
    add_track_handler,
)

# Add rotating file handlers (daily rotation, 7 days retention)
add_file_handler_to_logger(name="app", dir_path="./logs", level="DEBUG")
add_file_handler_to_logger(name="app", dir_path="./logs", level="ERROR")

# Add tracker handler (plain message lines)
add_track_handler(dir_path="./logs")

logger.info("Hello from new_logger")
tracker_logger.info("user_id=123 action=click item_id=42")

Requirements

  • Python >= 3.8
  • loguru>=0.7

Notes

  • Console output filters to INFO and above.
  • File handlers rotate daily and keep 7 days.
  • tracker_logger writes only to its tracker sink, not console.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

new_logger-0.1.0.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

new_logger-0.1.0-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

File details

Details for the file new_logger-0.1.0.tar.gz.

File metadata

  • Download URL: new_logger-0.1.0.tar.gz
  • Upload date:
  • Size: 2.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for new_logger-0.1.0.tar.gz
Algorithm Hash digest
SHA256 8053f125a7edb4612400438c96c858ea28dea523482b6534699cfdde5c91bd86
MD5 a09db88f834a0435d591910b9481ea17
BLAKE2b-256 557bb868e770d5c454bea4a1b26169107ba66be165f2f92b767c1b57fd3c4d3b

See more details on using hashes here.

File details

Details for the file new_logger-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: new_logger-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 2.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for new_logger-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 725f6e3e2c40de9a58d2fbd356b3af486046cb5931160194f67a40a90c9c8539
MD5 df427111cb321808769b7b50ddfafad7
BLAKE2b-256 d6ce45c412290b3dca4ad78cff0daab685c7536d45a2451594d4a43c13a073b7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page