Skip to main content

Custom Logger Module

Project description

PyPI Version Documentation Status

Custom Logger Module

PyLogForge is a Python module that provides advanced logging functionality with color-coded log levels, customizable formatters, and flexible log output configuration.

Installation

You can install pylogforge using pip:

pip install pylogforge

Usage

To use pylogforge, follow these steps:

  1. Import the module:
    from pylogforge import PyLogForge
    
  2. Create an instance of the PyLogForge class, the name is optional.:
    logger = PyLogForge(name="my_logger").logger
    
  3. Start logging messages:
    logger.debug("This is a debug message")
    logger.info("This is an info message")
    logger.warning("This is a warning message")
    logger.error("This is an error message")
    logger.critical("This is a critical message")
    
  4. On the additional files you just need to include the import and call getLogger.
    import logging
    logger = logging.getLogger(name="my_logger")
    
    logger.critical("This is a critical message")
    

Configuration

pylogforge can be configured using environment variables:

  • LOG_CONSOLE_LEVEL: Set the console log level (default: DEBUG)
  • LOG_FILE_LEVEL: Set the file log level (default: INFO)
  • LOG_DIR: Set the directory to store log files (default: no file logging)
  • LOG_SINGLE_FILE: Set to "true" to log to a single file (default: separate files for each log level)

For example, you can set the environment variables before running your Python script:

export LOG_CONSOLE_LEVEL=INFO
export LOG_FILE_LEVEL=DEBUG
export LOG_DIR=/path/to/logs
export LOG_SINGLE_FILE=True

Contributing

Contributions to pylogforge are welcome! If you encounter any issues, have feature requests, or want to contribute improvements, please submit an issue or pull request on the GitHub repository <https://github.com/krash0n/pylogforge>_.

License

pylogforge is distributed under the MIT License. See the LICENSE <https://github.com/krash0n/pylogforge/blob/main/LICENSE>_ file for more details.

Links

  • PyPI Package <https://pypi.org/project/pylogforge>_
  • Documentation <https://pylogforge.readthedocs.io/en/latest>_
  • GitHub Repository <https://github.com/krash0n/pylogforge>_

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

PyLogForge-1.0.1.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

PyLogForge-1.0.1-py3-none-any.whl (3.7 kB view details)

Uploaded Python 3

File details

Details for the file PyLogForge-1.0.1.tar.gz.

File metadata

  • Download URL: PyLogForge-1.0.1.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for PyLogForge-1.0.1.tar.gz
Algorithm Hash digest
SHA256 db4a51fc5166e2a66d3ff9a030b8f0b473d0c956b3f5385d488690c4c25d6228
MD5 95f8ce93ac9bc35047452314d385533e
BLAKE2b-256 9da99ee2367125cad2e80723d56be51533aad1514c6958fef2af36f173eda1ef

See more details on using hashes here.

File details

Details for the file PyLogForge-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: PyLogForge-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.11

File hashes

Hashes for PyLogForge-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 40cdaa9196481fba1ff3f9a14b07f461f54f13305d8e7d11080d56a1a79429bb
MD5 a411ad2e9b7f0f757ad844ca918e914d
BLAKE2b-256 d2b2f4d140c4eed97a2ee6d68b0413671e8cacf6d47592653f470a34403cdf6a

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