Skip to content

Elemento-Modular-Cloud/elogger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

elogger

AtomOS elogger

A simple loguru wrapper for our use

Atomosphere fastapi logger

logger_manaager_fastapi.py is a custom logger with error highliting with colors and dynamic tracing of API requests. It is used in the Atomosphere project to log API requests and responses in a clear and concise way.

Example log lines after setup:

log_example

Usage:

    ----------- ON MAIN ADD:
    from elogger.logger_manager_fastapi import setup_logging
    from asgi_correlation_id import CorrelationIdMiddleware
    setup_logging()
    logger = logging.getLogger(__name__)

    app = FastAPI(docs_url=None)

    app.add_middleware(
        CorrelationIdMiddleware,
        header_name="X-Request-ID",
        update_request_header=True,
    )

    ----------- ON OTHER MODULES ADD:
    import logging
    logging.debug("This is a debug log")
    logging.info("This is an info log")
    logging.warning("This is a warning log")
    logging.error("This is an error log")
    logging.critical("This is a critical log")

About

A simple loguru wrapper for our use

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages