C# Class Microsoft.ApplicationInsights.TraceListener.ApplicationInsightsTraceListener

Listener that routes all tracing and debugging output to ApplicationInsights logging framework. The messages will be uploaded to the Application Insights cloud service.
Inheritance: System.Diagnostics.TraceListener
Mostrar archivo Open project: Microsoft/ApplicationInsights-dotnet-logging

Private Properties

Property Type Description
CreateTraceData void
GetSeverityLevel SeverityLevel

Public Methods

Method Description
ApplicationInsightsTraceListener ( ) : System

Initializes a new instance of the ApplicationInsightsTraceListener class, without specifying a component ID.

ApplicationInsightsTraceListener ( string instrumentationKey ) : System

Initializes a new instance of the ApplicationInsightsTraceListener class, and validates the component id passed as the initialize-data. An empty or null Component ID is acceptable because the event source will fall back to the one set in ApplicationInsights.config, however an invalid Component ID will throw an exception.

TraceData ( TraceEventCache eventCache, string source, TraceEventType eventType, int id ) : void

Writes trace data to the listener specific output.

TraceData ( TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data ) : void

Writes trace data to the listener specific output.

TraceEvent ( TraceEventCache eventCache, string source, TraceEventType eventType, int id ) : void

Writes trace information, a message, and event information to the listener specific output.

TraceEvent ( TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format ) : void

Writes trace information, a message, and event information to the listener specific output.

Write ( string message ) : void

Writes the specified message to the listener.

WriteLine ( string message ) : void

Writes the specified message to the listener followed by a line terminator.

Private Methods

Method Description
CreateTraceData ( TraceEventCache eventCache, TraceEventType eventType, int id, Microsoft.ApplicationInsights.DataContracts.TraceTelemetry trace ) : void
GetSeverityLevel ( TraceEventType eventType ) : SeverityLevel

Method Details

ApplicationInsightsTraceListener() public method

Initializes a new instance of the ApplicationInsightsTraceListener class, without specifying a component ID.
public ApplicationInsightsTraceListener ( ) : System
return System

ApplicationInsightsTraceListener() public method

Initializes a new instance of the ApplicationInsightsTraceListener class, and validates the component id passed as the initialize-data. An empty or null Component ID is acceptable because the event source will fall back to the one set in ApplicationInsights.config, however an invalid Component ID will throw an exception.
public ApplicationInsightsTraceListener ( string instrumentationKey ) : System
instrumentationKey string Instrumentation Key of your application.
return System

TraceData() public method

Writes trace data to the listener specific output.
public TraceData ( TraceEventCache eventCache, string source, TraceEventType eventType, int id ) : void
eventCache System.Diagnostics.TraceEventCache A TraceEventCache object that contains the current process ID, thread ID, and stack trace information.
source string A name used to identify the output, typically the name of the application that generated the trace event.
eventType TraceEventType One of the TraceEventType values specifying the type of event that has caused the trace.
id int A numeric identifier for the event.
return void

TraceData() public method

Writes trace data to the listener specific output.
public TraceData ( TraceEventCache eventCache, string source, TraceEventType eventType, int id, object data ) : void
eventCache System.Diagnostics.TraceEventCache A TraceEventCache object that contains the current process ID, thread ID, and stack trace information.
source string A name used to identify the output, typically the name of the application that generated the trace event.
eventType TraceEventType One of the TraceEventType values specifying the type of event that has caused the trace.
id int A numeric identifier for the event.
data object The trace data to emit.
return void

TraceEvent() public method

Writes trace information, a message, and event information to the listener specific output.
public TraceEvent ( TraceEventCache eventCache, string source, TraceEventType eventType, int id ) : void
eventCache System.Diagnostics.TraceEventCache A TraceEventCache object that contains the current process ID, thread ID, and stack trace information.
source string A name used to identify the output, typically the name of the application that generated the trace event.
eventType TraceEventType One of the TraceEventType values specifying the type of event that has caused the trace.
id int A numeric identifier for the event.
return void

TraceEvent() public method

Writes trace information, a message, and event information to the listener specific output.
public TraceEvent ( TraceEventCache eventCache, string source, TraceEventType eventType, int id, string format ) : void
eventCache System.Diagnostics.TraceEventCache A TraceEventCache object that contains the current process ID, thread ID, and stack trace information.
source string A name used to identify the output, typically the name of the application that generated the trace event.
eventType TraceEventType One of the TraceEventType values specifying the type of event that has caused the trace.
id int A numeric identifier for the event.
format string A format string that contains zero or more format items, which correspond to objects in the args array.
return void

Write() public method

Writes the specified message to the listener.
public Write ( string message ) : void
message string A message to write.
return void

WriteLine() public method

Writes the specified message to the listener followed by a line terminator.
public WriteLine ( string message ) : void
message string A message to write.
return void