Show / Hide Table of Contents

    Class GraphLogger

    Logging portion of graph.

    Inheritance
    Object
    Disposable
    GraphLogger
    Implements
    IDisposable
    IGraphLogger
    IObservable<LogEvent>
    Inherited Members
    Disposable.Dispose()
    Disposable.IsDisposed
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Microsoft.Graph.Communications.Common.Telemetry
    Assembly: Microsoft.Graph.Communications.Common.dll
    Syntax
    public class GraphLogger : Disposable, IDisposable, IGraphLogger, IObservable<LogEvent>

    Constructors

    GraphLogger(String, IEnumerable<Object>, Boolean, ObfuscationConfiguration)

    Initializes a new instance of the GraphLogger class.

    Declaration
    public GraphLogger(string component = null, IEnumerable<object> properties = null, bool redirectToTrace = false, ObfuscationConfiguration obfuscationConfiguration = null)
    Parameters
    Type Name Description
    String component

    The component in which log is createdThe component in which this logger is created.

    IEnumerable<Object> properties

    Common properties to be set on each event

    Boolean redirectToTrace

    if set to true [redirect to trace].

    ObfuscationConfiguration obfuscationConfiguration

    The obfuscation configuration

    Fields

    StartupLoggerNameSuffix

    The startup logger name prefix

    Declaration
    public const string StartupLoggerNameSuffix = "_Startup"
    Field Value
    Type Description
    String

    Properties

    Component

    Gets or the component of logger.

    Declaration
    public string Component { get; }
    Property Value
    Type Description
    String

    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.

    Declaration
    public ObfuscationConfiguration ObfuscationConfiguration { get; }
    Property Value
    Type Description
    ObfuscationConfiguration

    Properties

    Gets the common properties for each event.

    Declaration
    public IReadOnlyDictionary<Type, object> Properties { get; }
    Property Value
    Type Description
    IReadOnlyDictionary<Type, Object>

    Methods

    Dispose(Boolean)

    Protected implementation of dispose. This will be triggered only once regardless if manually disposed or garbage collected.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    Boolean disposing

    true to release both managed and unmanaged resources; false to release only unmanaged resources.

    Overrides
    Disposable.Dispose(Boolean)

    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>)

    Create a subscription for logging events.

    Declaration
    public IDisposable Subscribe(IObserver<LogEvent> observer)
    Parameters
    Type Name Description
    IObserver<LogEvent> observer

    The object that is to receive notifications.

    Returns
    Type Description
    IDisposable

    A reference to an interface that allows observers to stop receiving notifications before the provider has finished sending them.

    Implements

    System.IDisposable
    IGraphLogger
    System.IObservable<T>

    Extension Methods

    AdditionalDataExtensions.SetInAdditionalData(Object, String, Object)
    Extensions.Pin(Object)
    Extensions.ChangeType(Object, Type)
    Extensions.ChangeType<T>(Object)
    Extensions.CreateObserver<T>(IObservable<T>, Action<T>, Action<Exception>, Action)
    Extensions.TryDispose(Object, IGraphLogger)
    ReflectionUtils.GetPropertyUsingReflection(Object, String)
    ReflectionUtils.SetPropertyUsingReflection(Object, String, Object)
    Validator.IsNull(Object, String, String)
    Validator.NotNull<T>(T, String, String)
    Validator.Equals<T>(T, T, String, String)
    Validator.Equals<T, TE>(T, T, String)
    Validator.NotEquals<T>(T, T, String, String)
    LoggingExtensions.Log(IGraphLogger, TraceLevel, Exception, String, String, Guid, String, String, Int32)
    LoggingExtensions.Error(IGraphLogger, Exception, String, String, Guid, String, String, Int32)
    LoggingExtensions.Error(IGraphLogger, String, String, Guid, String, String, Int32)
    LoggingExtensions.Info(IGraphLogger, String, String, Guid, String, String, Int32)
    LoggingExtensions.Warn(IGraphLogger, Exception, String, String, Guid, String, String, Int32)
    LoggingExtensions.Warn(IGraphLogger, String, String, Guid, String, String, Int32)
    LoggingExtensions.Verbose(IGraphLogger, String, String, Guid, String, String, Int32)
    LoggingExtensions.LogHttpMessage(IGraphLogger, TraceLevel, TransactionDirection, HttpTraceType, String, String, String, IEnumerable<KeyValuePair<String, IEnumerable<String>>>, Int32, String, Nullable<Int64>, Guid, Guid, String, String, Int32)
    LoggingExtensions.Metric(IGraphLogger, String, String, Int64, Dictionary<String, String>, Boolean, String, Guid, String, String, Int32)
    LoggingExtensions.SerializeAndObfuscate(IGraphLogger, Object, Formatting)
    LoggingExtensions.Obfuscate(IGraphLogger, Object, ObfuscationTag)
    LoggingExtensions.GetHeaderText(IGraphLogger, IEnumerable<KeyValuePair<String, IEnumerable<String>>>)
    LoggingExtensions.CreateShim(IGraphLogger, String, Nullable<Guid>, IEnumerable<Object>, ObfuscationConfiguration)
    LoggingExtensions.CreateILogger(IGraphLogger, String, Guid, LogEventType, IEnumerable<Object>)
    LoggingExtensions.BindToILoggerFactory(GraphLogger, ILoggerFactory, ILogEventFormatter)
    LoggingExtensions.EnterMethod(IGraphLogger, Guid, String, String, Int32)
    LoggingExtensions.LeaveMethod(IGraphLogger, Guid, String, String, Int32)
    Back to top Copyright (c) Microsoft Corporation. All rights reserved.