Skip to main content

dlogger by drawiks

Project description

📝 dlogger

PyPI version Python 3.7+ License MIT Status

dlogger — simple logger for personal projects

(─‿‿─)

     ____    __
    / __ \  / /   ____   ____ _ ____ _ ___   _____
   / / / / / /   / __ \ / __ `// __ `// _ \ / ___/
  / /_/ / / /___/ /_/ // /_/ // /_/ //  __// /
 /_____/ /_____/\____/ \__, / \__, / \___//_/
                      /____/ /____/

📦 installation

pip install dlogger-drawiks

📑 quick start

from dlogger import logger

logger.info("hello, world!")
logger.error("something went wrong")

with configuration:

from dlogger import logger

logger.configure(
    level="INFO",
    log_file="app.log",
    rotation="10MB",
    retention="7 days",
    compression=True
)

logger.debug("this won't be shown")
logger.info("but this will")

🧩 features

  • 🎨 TrueColor output — HEX/RGB support powered by dcolor
  • 🚀 high performance — use of buffers and call context caching
  • 🧵 thread safety — stability in multithreaded applications thanks to locks
  • 💾 write guarantee — automatic buffer reset upon correct program termination
  • 📁 smart rotation — by size (10MB, 1GB) or time (1 day, 12 hours)
  • 🗑️ auto cleanup — scheduled deletion of old files (retention="30 days")
  • 📦 compression — automatic archiving of old logs to .gz
  • 🛠️ minimal dependencies — only dcolor
  • reliability — protection from memory leaks, data loss and deadlocks

📖 usage

log levels

logger.configure(level="INFO")  # DEBUG, INFO, WARNING, ERROR, CRITICAL

size-based rotation

logger.configure(
    log_file="app.log",
    rotation="10MB"  # or "500KB", "1GB"
)

once the file reaches 10MB → app.log.20260216_143022

time-based rotation

logger.configure(
    log_file="app.log",
    rotation="1 day"  # or "12 hours", "1 week"
)

log retention

logger.configure(
    log_file="app.log",
    retention="7 days"  # or "2 weeks", "1 month"
)

logs older than 7 days will be deleted automatically

compression

logger.configure(
    log_file="app.log",
    rotation="10MB",
    compression=True  # old logs → .gz
)

full configuration

logger.configure(
    level="INFO",              # minimum log level
    log_file="logs/app.log",   # path to log file
    show_path=True,            # show module:function:
    rotation="10MB",           # size-based rotation
    retention="7 days",        # keep logs for 7 days
    compression=True           # compress old logs
    time_format="%H:%M:%S"     # time format - 14:30:22
)

💡 examples

simple logging

from dlogger import logger

logger.info("server started on port 8000")
logger.warning("memory usage at 80%")
logger.error("failed to connect to database")

with file

from dlogger import logger

logger.configure(
    level="DEBUG",
    log_file="app.log"
)

logger.debug("starting request processing")
logger.info("request processed successfully")

for production

from dlogger import logger

logger.configure(
    level="INFO",
    log_file="logs/production.log",
    rotation="50MB",
    retention="30 days",
    compression=True
    time_format="%Y-%m-%d %H:%M:%S"
)

logger.info("application started")
logger.error("critical error in payments module")

📝 log format

console:

2026-02-17 14:09:13 | INFO     | src.bot:run: - init

file:

2026-02-17 14:09:13 | INFO     | src.main:run: init
2026-02-17 14:09:13 | ERROR    | src.main:run: error

📜 license

MIT

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

dlogger_drawiks-0.2.4.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

dlogger_drawiks-0.2.4-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file dlogger_drawiks-0.2.4.tar.gz.

File metadata

  • Download URL: dlogger_drawiks-0.2.4.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for dlogger_drawiks-0.2.4.tar.gz
Algorithm Hash digest
SHA256 94be9ff403ade95b563a0042608382b565c6d18ee6120b12f97bc377854123d9
MD5 ee772014c16c086b072629b174c06108
BLAKE2b-256 6b7eb7b38434709672abe70bc2a15e4501f07399a0590bc533e07fd1a422d4e8

See more details on using hashes here.

File details

Details for the file dlogger_drawiks-0.2.4-py3-none-any.whl.

File metadata

File hashes

Hashes for dlogger_drawiks-0.2.4-py3-none-any.whl
Algorithm Hash digest
SHA256 da399b8340388badbd512f102456ed8ab1b0e0ed6a97153b279e4689a1562630
MD5 5c101389db69a93083979d05ae06dd1d
BLAKE2b-256 f02ff82a7cf19a7fe1ab3cf689b22db8ba91980c276bf57a52e1b2b19b6a798e

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