django_socio_grpc.log

logging utils

Module Contents

Classes

GRPCHandler

Functions

default_get_log_extra_context

This method is the default used for the grpc_settings: LOG_EXTRA_CONTEXT_FUNCTION. It allow logs to have extra data about the current context of the log. Used especially for tracing system.

set_log_record_factory

This method is not used by default. You juste have to execute it in your app code. Preferentially at some entrypoint. It will allow to inject the default extra context of each service in the log record if needed. If this method is call before any log you can use grpc_service_name, grpc_action, grpc_user_pk in your log formatter

Data

old_taceback_function

API

django_socio_grpc.log.old_taceback_function

None

class django_socio_grpc.log.GRPCHandler(level=NOTSET)

Bases: logging.Handler

emit(record, is_intercept_except=False)
async call_user_handler(record, is_intercept_except)
call_user_handler_sync(record, is_intercept_except)
log_unhandled_exception(exc, value=None, tb=None)
generate_asctime()
extract_exc_info_from_traceback(formatted_exception)
django_socio_grpc.log.default_get_log_extra_context(service: django_socio_grpc.generics.GenericService)

This method is the default used for the grpc_settings: LOG_EXTRA_CONTEXT_FUNCTION. It allow logs to have extra data about the current context of the log. Used especially for tracing system.

django_socio_grpc.log.set_log_record_factory()

This method is not used by default. You juste have to execute it in your app code. Preferentially at some entrypoint. It will allow to inject the default extra context of each service in the log record if needed. If this method is call before any log you can use grpc_service_name, grpc_action, grpc_user_pk in your log formatter