Skip to main content

Custom file logging system for Python applications

Project description

LogKontrol

LogKontrol is a Python library designed to provide flexible and configurable logging capabilities across different modules of a Python application. It supports file and console logging, with easy customization through a YAML configuration file.

Features

  • File logging: with automatic file creation
  • Configurable: logging levels and message formats
  • Versatile: Support for logging plain messages, variable states, function calls, and JSON content
  • Debugging: Optional console output for immediate debugging

Installation

To install LogKontrol, run the following command:

pip install logkontrol

You can also clone this repository and install it directly from the source:

git clone https://github.com/voidfemme/logkontrol.git
cd logkontrol
pip install .

Usage

Here's a quick example to get you started with LogKontrol:

from logkontrol.logkontrol import init_logging, log_message

# Initialize the logging system
init_logging()

# Log a simple message
log_message('general', 'Hello, world!')

Configuration

LogKontrol is highly customizable through a simple YAML configuration file. Here's the default configuration:

log_file_paths:
  general: 'logs/general.log'
  errors: 'logs/errors.log'
  debug: 'logs/debug.log'
log_format: '[{timestamp}] [{level}] {message}'
timestamp_format: '%Y-%m-%d %H:%M:%S'
log_level: 'INFO'
console_output: True

Or, specify a different configuration file during initialization:

init_logging(config_file_path='path/to/your/config.yaml')

To add your own logging categories, simply add a new entry under 'log_file_paths' in the YAML file. For example, to add an audit trail log, you might add:

audit: 'logs/audit.log'

This allows you to tailor the logging system to suit the needs of your application with minimal effort.

Contributing

Contributions are welcome! Please fork the repository and open a pull request with your improvements.

License

LogKontrol by voidfemme is marked with CC0 1.0 Universal 💖 LICENSE file for details.

Philosophy

LogKontrol is released into the public domain as a reflection of my belief in the principle of "From each according to their ability, to each according to their needs." I believe that software should be a collective effort, where individuals contribute their skills and knowledge for the benefit of the community as a whole.

By dedicating this library to the public domain, I aim to ensure that it remains freely available to anyone who needs it, without barriers or restrictions. I encourage users to utilize, modify, and distribute LogKontrol according to their needs, and I welcome contributions from those who have the ability to improve and enhance the library.

My goal is to foster a spirit of collaboration, mutual aid, and shared ownership in the software development community. I believe that by working together and pooling our resources, we can create tools and technologies that serve the common good and promote a more equitable and inclusive society.

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

logkontrol-0.1.1.tar.gz (6.0 kB view details)

Uploaded Source

Built Distribution

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

logkontrol-0.1.1-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file logkontrol-0.1.1.tar.gz.

File metadata

  • Download URL: logkontrol-0.1.1.tar.gz
  • Upload date:
  • Size: 6.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for logkontrol-0.1.1.tar.gz
Algorithm Hash digest
SHA256 32000fc04e830d55251e349d93b39e50250bf297e1e58ad2d4775f70a5547dfe
MD5 cef35f0babd1b5c4523b5f3a69f1ad89
BLAKE2b-256 256a0e63919d49781216d3e224655859bb33d845b0ccbf2f13e80a6ce4d3c93e

See more details on using hashes here.

File details

Details for the file logkontrol-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: logkontrol-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.8

File hashes

Hashes for logkontrol-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c193efae1413dc96f2d0411eb6d16823f1819bd6430770322136aa9dfcdd278f
MD5 beca2546c29f249ec8daa74c76390ede
BLAKE2b-256 4041dfd8b96e9f1fc3b4794a495267fb7b45435f3f4b0d1037211f094fba0649

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