Settings¶
logging_endpoint is configured by adding the following settings to the Django settings.
-
LOGGER¶ The name of the logger to send the received logs to.
- Default
'LoggingEndpoint'
Examples:
LOGGING_ENDPOINT_LOGGER = 'MyLogger'
-
MESSAGE_HANDLER¶ Function to process the incoming message by the application. Takes the original message and request under these names as keywords and should return a tuple of
- logger name (or None)
- loglevel
- log message
- args for the log call
- kwargs for the log call
def default_handler(**kwargs): """Return the message as is as level INFO on the default logger.""" log_data = kwargs.get('message') return None, INFO, log_data.decode(), tuple(), dict()
- Default
logging_endpoint.message_handler.default_handler
Examples:
LOGGING_ENDPOINT_MESSAGE_HANDLER = log_message_handler LOGGING_ENDPOINT_MESSAGE_HANDLER = 'path.to.handler'
-
OVERWRITE_LOGGER¶ If set to true an incoming json message will be sent to the logger specified under the
loggerkey. Otherwise the message is sent to the standard logger (see settingLOGGER) and the logger value is added to the message.- Default
False
Examples:
LOGGING_ENDPOINT_OVERWRITE_LOGGER = False
-
DECOMPOSE_JSON_LIST¶ If set to true an incoming json list will be decomposed into separate messages:
- True:
- [“log1”, “log2”] =>
- INFO log1 INFO log2
- False:
- [“log1”, “log2”] => INFO [“log1”, “log2”]
- Default
True
Examples:
LOGGING_ENDPOINT_DECOMPOSE_JSON_LIST = True