PyLogForge is a Python module that provides advanced logging functionality with color-coded log levels, customizable formatters, and flexible log output configuration.
You can install pylogforge using pip:
pip install pylogforge
To use pylogforge, follow these steps:
- Import the module:
from pylogforge import PyLogForge
- Create an instance of the PyLogForge class, the name is optional.:
logger = PyLogForge(name="my_logger").logger
- 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")
- 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")
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
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>
_.
pylogforge is distributed under the MIT License. See the LICENSE <https://github.com/krash0n/pylogforge/blob/main/LICENSE>
_ file for more details.
PyPI Package <https://pypi.org/project/pylogforge>
_Documentation <https://pylogforge.readthedocs.io/en/latest>
_GitHub Repository <https://github.com/krash0n/pylogforge>
_