logging_handler module

Contains functionality for sending telemetry to Application Insights.

Classes

AppInsightsLoggingHandler

Integration point between Python's logging framework and the Application Insights service.

Functions

get_appinsights_log_handler(instrumentation_key, logger=None, *args, **kwargs)

Enable the Application Insights logging handler for specified logger and instrumentation key.

Enable diagnostics collection with the set_diagnostics_collection(send_diagnostics=True, verbosity=20, reason='', path=None) function.

get_appinsights_log_handler(instrumentation_key, logger=None, *args, **kwargs)

Parameters

instrumentation_key
str

The Application Insights instrumentation key.

logger
logger

The logger sending the message. If not specified, the Python root logger is used.

default value: None
args
list

Optional arguments for formatting messages.

kwargs
dict

Optional keyword arguments for adding additional information to messages.

Returns

The logging handler.

Return type