Unosquare
    Show / Hide Table of Contents

    Class Logger

    Entry-point for logging. Use this static class to register/unregister loggers instances. By default, the ConsoleLogger is registered.

    Inheritance
    Object
    Logger
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Swan.Logging
    Syntax
    public static class Logger

    Methods

    Debug(Exception, String, String, String, String, Int32)

    Logs a debug message to the console.

    Declaration
    public static void Debug(this Exception extendedData, string source, string message, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    Exception extendedData

    The exception.

    String source

    The source.

    String message

    The message.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Debug(String, String, Object, String, String, Int32)

    Logs a debug message to the console.

    Declaration
    public static void Debug(this string message, string source = null, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The message.

    String source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Debug(String, Type, Object, String, String, Int32)

    Logs a debug message to the console.

    Declaration
    public static void Debug(this string message, Type source, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The message.

    Type source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member.

    String callerFilePath

    The caller file path.

    Int32 callerLineNumber

    The caller line number.

    Dump(Object, String, String, String, String, Int32)

    Logs a trace message showing all possible non-null properties of the given object This method is expensive as it uses Stringify internally.

    Declaration
    public static void Dump(this object obj, string source, string text = "Object Dump", string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    Object obj

    The object.

    String source

    The source.

    String text

    The title.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Dump(Object, Type, String, String, String, Int32)

    Logs a trace message showing all possible non-null properties of the given object This method is expensive as it uses Stringify internally.

    Declaration
    public static void Dump(this object obj, Type source, string text = "Object Dump", string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    Object obj

    The object.

    Type source

    The source.

    String text

    The text.

    String callerMemberName

    Name of the caller member.

    String callerFilePath

    The caller file path.

    Int32 callerLineNumber

    The caller line number.

    Error(Exception, String, String, String, String, Int32)

    Logs an error message to the console's standard error.

    Declaration
    public static void Error(this Exception ex, string source, string message, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    Exception ex

    The exception.

    String source

    The source.

    String message

    The message.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Error(String, String, Object, String, String, Int32)

    Logs an error message to the console's standard error.

    Declaration
    public static void Error(this string message, string source = null, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The text.

    String source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Error(String, Type, Object, String, String, Int32)

    Logs an error message to the console's standard error.

    Declaration
    public static void Error(this string message, Type source, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The message.

    Type source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member.

    String callerFilePath

    The caller file path.

    Int32 callerLineNumber

    The caller line number.

    Fatal(Exception, String, String, String, String, Int32)

    Logs a warning message to the console.

    Declaration
    public static void Fatal(this Exception extendedData, string source, string message, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    Exception extendedData

    The extended data.

    String source

    The source.

    String message

    The message.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Fatal(String, String, Object, String, String, Int32)

    Logs a warning message to the console.

    Declaration
    public static void Fatal(this string message, string source = null, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The text.

    String source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Fatal(String, Type, Object, String, String, Int32)

    Logs a warning message to the console.

    Declaration
    public static void Fatal(this string message, Type source, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The message.

    Type source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member.

    String callerFilePath

    The caller file path.

    Int32 callerLineNumber

    The caller line number.

    Info(Exception, String, String, String, String, Int32)

    Logs an info message to the console.

    Declaration
    public static void Info(this Exception extendedData, string source, string message, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    Exception extendedData

    The extended data.

    String source

    The source.

    String message

    The message.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Info(String, String, Object, String, String, Int32)

    Logs an info message to the console.

    Declaration
    public static void Info(this string message, string source = null, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The text.

    String source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Info(String, Type, Object, String, String, Int32)

    Logs an info message to the console.

    Declaration
    public static void Info(this string message, Type source, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The message.

    Type source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member.

    String callerFilePath

    The caller file path.

    Int32 callerLineNumber

    The caller line number.

    Log(Exception, Nullable<Type>, String, String, String, Int32)

    Logs an error message to the console's standard error.

    Declaration
    public static void Log(this Exception ex, Type? source = default(Type? ), string message = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    Exception ex

    The ex.

    Nullable<Type> source

    The source.

    String message

    The message.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Log(Exception, String, String, String, String, Int32)

    Logs an error message to the console's standard error.

    Declaration
    public static void Log(this Exception ex, string source = null, string message = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    Exception ex

    The ex.

    String source

    The source.

    String message

    The message.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Log(String, String, LogLevel, Object, String, String, Int32)

    Logs the specified message.

    Declaration
    public static void Log(this string message, string source, LogLevel messageType, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The message.

    String source

    The source.

    LogLevel messageType

    Type of the message.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Log(String, Type, LogLevel, Object, String, String, Int32)

    Logs the specified message.

    Declaration
    public static void Log(this string message, Type source, LogLevel messageType, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The message.

    Type source

    The source.

    LogLevel messageType

    Type of the message.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member.

    String callerFilePath

    The caller file path.

    Int32 callerLineNumber

    The caller line number.

    NoLogging()

    Remove all the loggers.

    Declaration
    public static void NoLogging()

    RegisterLogger(ILogger)

    Registers the logger.

    Declaration
    public static void RegisterLogger(ILogger logger)
    Parameters
    Type Name Description
    ILogger logger

    The logger.

    RegisterLogger<T>()

    Registers the logger.

    Declaration
    public static void RegisterLogger<T>()
        where T : ILogger
    Type Parameters
    Name Description
    T

    The type of logger to register.

    Trace(Exception, String, String, String, String, Int32)

    Logs a trace message to the console.

    Declaration
    public static void Trace(this Exception extendedData, string source, string message, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    Exception extendedData

    The extended data.

    String source

    The source.

    String message

    The message.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Trace(String, String, Object, String, String, Int32)

    Logs a trace message to the console.

    Declaration
    public static void Trace(this string message, string source = null, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The text.

    String source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Trace(String, Type, Object, String, String, Int32)

    Logs a trace message to the console.

    Declaration
    public static void Trace(this string message, Type source, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The message.

    Type source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member.

    String callerFilePath

    The caller file path.

    Int32 callerLineNumber

    The caller line number.

    UnregisterLogger(ILogger)

    Unregisters the logger.

    Declaration
    public static void UnregisterLogger(ILogger logger)
    Parameters
    Type Name Description
    ILogger logger

    The logger.

    UnregisterLogger<T>()

    Unregisters the logger.

    Declaration
    public static void UnregisterLogger<T>()
    Type Parameters
    Name Description
    T

    The type of logger to unregister.

    Warn(Exception, String, String, String, String, Int32)

    Logs a warning message to the console.

    Declaration
    public static void Warn(this Exception extendedData, string source, string message, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    Exception extendedData

    The extended data.

    String source

    The source.

    String message

    The message.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Warn(String, String, Object, String, String, Int32)

    Logs a warning message to the console.

    Declaration
    public static void Warn(this string message, string source = null, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The text.

    String source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member. This is automatically populated.

    String callerFilePath

    The caller file path. This is automatically populated.

    Int32 callerLineNumber

    The caller line number. This is automatically populated.

    Warn(String, Type, Object, String, String, Int32)

    Logs a warning message to the console.

    Declaration
    public static void Warn(this string message, Type source, object extendedData = null, string callerMemberName = "", string callerFilePath = "", int callerLineNumber = 0)
    Parameters
    Type Name Description
    String message

    The message.

    Type source

    The source.

    Object extendedData

    The extended data.

    String callerMemberName

    Name of the caller member.

    String callerFilePath

    The caller file path.

    Int32 callerLineNumber

    The caller line number.

    Comments

    Back to top Copyright © 2017-2019 Unosquare