aio_microservice.core.logging

Classes

InterceptHandler

Default handler from examples in loguru documentation.

Functions

setup_logging([level])

Setup logging through loguru.

Module Contents

class aio_microservice.core.logging.InterceptHandler(level=NOTSET)[source]

Bases: logging.Handler

Default handler from examples in loguru documentation.

See https://loguru.readthedocs.io/en/stable/overview.html#entirely-compatible-with-standard-logging.

emit(record)[source]

Outputs the record through loguru.

Parameters:

record (logging.LogRecord) – The logging record.

Return type:

None

aio_microservice.core.logging.setup_logging(level=logging.INFO)[source]

Setup logging through loguru.

This tries its best to force all logs through loguru. To achieve this an InterceptionHandler is registered.

Further warnings will be forced into loguru.

Parameters:

level (int) – The loglevel to apply to the root logger.

Return type:

None