Class GraphLoggerShim
The graph logger shim. This wrapper on the IGraphLogger attaches some extra data to each log request.
Inherited Members
Namespace: Microsoft.Graph.Communications.Common.Telemetry
Assembly: Microsoft.Graph.Communications.Common.dll
Syntax
public class GraphLoggerShim : ObjectRoot, IGraphLogger, IObservable<LogEvent>
Constructors
GraphLoggerShim(IGraphLogger, String, Nullable<Guid>, IEnumerable<Object>, ObfuscationConfiguration)
Initializes a new instance of the GraphLoggerShim class.
Declaration
public GraphLoggerShim(IGraphLogger graphLogger, string component = null, Guid? correlationId = default(Guid? ), IEnumerable<object> properties = null, ObfuscationConfiguration obfuscationConfiguration = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IGraphLogger | graphLogger | The graph logger. |
| String | component | The component. |
| Nullable<Guid> | correlationId | The correlation identifier. If null, shim will use the correlationId from GraphLogger |
| IEnumerable<Object> | properties | The properties. |
| ObfuscationConfiguration | obfuscationConfiguration | The obfuscation configuration. |
Properties
CorrelationId
Gets or sets the correlation identifier. This is used to track correlation between multiple requests for one scenario.
Declaration
public Guid CorrelationId { get; set; }
Property Value
| Type | Description |
|---|---|
| Guid |
DiagnosticLevel
Gets or sets the diagnostic level for the logger.
Declaration
public TraceLevel DiagnosticLevel { get; set; }
Property Value
| Type | Description |
|---|---|
| TraceLevel |
LogicalThreadId
Gets or sets the logical thread identifier. This id is used for tracking the flow of one request throughout the lifetime until it ends.
Declaration
public uint LogicalThreadId { get; set; }
Property Value
| Type | Description |
|---|---|
| UInt32 |
ObfuscationConfiguration
Gets the obfuscation configuration. This is used to obfuscate PII and other data.
Declaration
public ObfuscationConfiguration ObfuscationConfiguration { get; }
Property Value
| Type | Description |
|---|---|
| ObfuscationConfiguration |
Properties
Gets the properties of the logger.
Declaration
public IReadOnlyDictionary<Type, object> Properties { get; }
Property Value
| Type | Description |
|---|---|
| IReadOnlyDictionary<Type, Object> |
Methods
Log(TraceLevel, String, String, Guid, Guid, LogEventType, IEnumerable<Object>, String, String, Int32)
Log messages classified as the provided trace level.
Declaration
public LogEvent Log(TraceLevel level, string message, string component = null, Guid correlationId = default(Guid), Guid requestId = default(Guid), LogEventType eventType = LogEventType.Trace, IEnumerable<object> properties = null, string memberName = null, string filePath = null, int lineNumber = 0)
Parameters
| Type | Name | Description |
|---|---|---|
| TraceLevel | level | The trace level. |
| String | message | A composite format string that includes one or more format items. |
| String | component | The component in which log is created |
| Guid | correlationId | The correlation identifier. |
| Guid | requestId | The request identifier. |
| LogEventType | eventType | Log event type |
| IEnumerable<Object> | properties | Extra properties for the log event |
| String | memberName | Calling function. |
| String | filePath | File name where code is located. |
| Int32 | lineNumber | Line number where code is located. |
Returns
| Type | Description |
|---|---|
| LogEvent | Log Event object. |
Subscribe(IObserver<LogEvent>)
Declaration
public IDisposable Subscribe(IObserver<LogEvent> observer)
Parameters
| Type | Name | Description |
|---|---|---|
| IObserver<LogEvent> | observer |
Returns
| Type | Description |
|---|---|
| IDisposable |