Skip to content

tomisore/UnifiedLogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnifiedLogger

A Python logging package that provides enhanced logging capabilities with support for colored output and JSON formatting.

Features

  • Colored console output for different log levels
  • JSON formatted logging for structured log data
  • File and console logging support
  • Customizable log formats
  • Support for extra fields in log messages

Installation

pip install unifiedlogger

Usage

from unifiedlogger.logger import Logger

# Create a logger instance
logger = Logger(
    name="MyApp",
    log_file="logs/app.log",  # Optional
    use_colors=True,          # Optional, defaults to True
    use_json=False           # Optional, defaults to False
)

# Log messages
logger.debug("Debug message")
logger.info("Info message")
logger.warning("Warning message")
logger.error("Error message")
logger.critical("Critical message")

# Log with extra fields
logger.info("User action", user_id=123, action="login")

Development

To run tests:

python -m unittest test_logger.py

License

MIT License

About

No description, website, or topics provided.

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages