Skip to main content

Dexoron Logging Framework for Python

Project description

dlf4p — Dexoron Logging Framework for Python

dlf4p is a lightweight and convenient logger for Python inspired by SLF4J. It provides a simple API for logging messages with support for log levels, colored console output, timestamps, and file logging.

The project is being developed as part of the DLF (Dexoron Logging Framework) family, with plans for implementations in other programming languages.

GitLab repository: https://gitlab.com/dexoron/dlf4p PyPi project: https://pypi.org/project/dlf4p


Features

  • Log levels: DEBUG, INFO, SUCCESS, WARNING, ERROR, FATAL
  • Colored console output
  • Timestamp support
  • Prefix support (e.g., module or component name)
  • File logging
  • Simple configuration via setup()
  • Lightweight and with no external dependencies

Installation

Install from PyPI:

pip install dlf4p

Quick Start

import dlf4p as dlf 

dlf.setup(time=True, color=True, simple=False, file_logging=True)

dlf.info("Application started", "Main")
dlf.success("Server successfully started", "Server")
dlf.warning("Slow response", "API")
dlf.error("Database connection error", "Database")
dlf.fatal("Critical error", "System")

Console output:

[12:30:10] [Main/INFO]: Application started
[12:30:11] [Server/SUCCESS]: Server successfully started
[12:30:12] [API/WARNING]: Slow response
[12:30:13] [Database/ERROR]: Database connection error
[12:30:14] [System/FATAL]: Critical error

Logger class example:

import dlf4p as dlf

dlf.setup(time=True, color=True, simple=False, file_logging=True)

log = dlf.Logger("Main")
log.info("Application started")

log = dlf.Logger("Core")
log.setLevel(2)  # SUCCESS and higher
log.info("Core module initialized")
log.success("Submodule loaded successfully")
log.warning("Disabled System modules")

Console output:

[12:30:10] [Main/INFO]: Application started
[12:30:11] [Core/SUCCESS]: Submodule loaded successfully
[12:30:12] [Core/WARNING]: Disabled System modules

Logs are saved to a file without ANSI color codes.


Configuration

The setup() function is used to configure the logger:

dlf.setup(
    time=True,        # show timestamp
    color=True,       # enable colored output
    simple=False,     # simplified log format (without prefixes)
    file_logging=True # enable file logging
)

Parameters:

  • time — enable or disable timestamps
  • color — enable or disable colors
  • simple — disable prefixes
  • file_logging — enable writing logs to a file

Run Example

From the project root:

python3 -m test.main

Philosophy

dlf4p is inspired by SLF4J (Simple Logging Facade for Java) and aims to:

  • provide a simple and unified logging interface
  • remain minimalistic
  • have no external dependencies
  • be easily extensible to other programming languages

License

This project is licensed under the MIT License. See the LICENSE file for details.


Author

Dexoron

GitLab: https://gitlab.com/dexoron GitHub: https://github.com/dexoron Website: https://dexoron.su


Project Links

Changelog: CHANGELOG
Contributing guide: CONTRIBUTING.md GitLab repository: https://gitlab.com/dexoron/dlf4p PyPi project: https://pypi.org/project/dlf4p


dlf4p — a simple logger today, a full logging framework tomorrow.

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

dlf4p-1.2.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

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

dlf4p-1.2.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file dlf4p-1.2.0.tar.gz.

File metadata

  • Download URL: dlf4p-1.2.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for dlf4p-1.2.0.tar.gz
Algorithm Hash digest
SHA256 4266aad964c54fbf96c44033af48b27ad8b26971f78a2b306fdc868cd6d9c814
MD5 0bf408e9b7547483eaa4a0e6e8c96b5d
BLAKE2b-256 aaa670f9abddd0a83688dc6d47a82856ef5bdd95f8c41d7a20871a08bf2366cf

See more details on using hashes here.

File details

Details for the file dlf4p-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: dlf4p-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for dlf4p-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c544b2e4e6b2c3b2170e44d626c79e44ee5380badf87bf865cd196c1eebcaf8
MD5 7656ab41b2fb94e3d537420e29104b57
BLAKE2b-256 52437189b89f4ff792de4d6ccac648748ac2cf67272f05fc868536e817262a5f

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