Search Results for

    Show / Hide Table of Contents

    Class Logger

    A logger that logs messages originating from Realm. The default logger can be replaced by setting Default.

    Inheritance
    Object
    Logger
    Namespace: Realms.Logging
    Assembly: Realm.dll
    Syntax
    public abstract class Logger
    Remarks

    A few default implementations are provided by Console, Null, and Function(Action<String>), but you can implement your own.

    Constructors

    | Improve this Doc View Source

    Logger()

    Initializes a new instance of the Logger class.

    Declaration
    protected Logger()

    Properties

    | Improve this Doc View Source

    Console

    Gets a Realms.Logging.Logger.ConsoleLogger that outputs messages to the default console. For most project types, that will be using WriteLine() but certain platforms may use different implementations.

    Declaration
    public static Logger Console { get; }
    Property Value
    Type Description
    Logger

    A Logger instance that outputs to the platform's console.

    | Improve this Doc View Source

    Default

    Gets or sets a custom Logger implementation that will be used by Realm whenever information must be logged.

    Declaration
    public static Logger Default { get; set; }
    Property Value
    Type Description
    Logger

    The logger to be used for Realm-originating messages.

    Remarks

    This is the logger that will be used to log diagnostic messages from Sync. It replaces the deprecated CustomLogger.

    | Improve this Doc View Source

    LogLevel

    Gets or sets the verbosity of log messages.

    Declaration
    public static LogLevel LogLevel { get; set; }
    Property Value
    Type Description
    LogLevel

    The log level for Realm-originating messages.

    Remarks

    This replaces the deprecated LogLevel.

    | Improve this Doc View Source

    Null

    Gets a Realms.Logging.Logger.NullLogger that ignores all messages.

    Declaration
    public static Logger Null { get; }
    Property Value
    Type Description
    Logger

    A Logger that doesn't output any messages.

    Methods

    | Improve this Doc View Source

    File(String, Encoding)

    Gets a Realms.Logging.Logger.FileLogger that saves the log messages to a file.

    Declaration
    public static Logger File(string filePath, Encoding encoding = null)
    Parameters
    Type Name Description
    String filePath

    Path of the file to save messages to. The file is created if it does not already exists.

    Encoding encoding

    Character encoding to use. Defaults to UTF8 if not specified.

    Returns
    Type Description
    Logger

    A Logger instance that will save log messages to a file.

    Remarks

    Please note that this logger is not optimized for performance, and could lead to overall sync performance slowdown with more verbose log levels.

    | Improve this Doc View Source

    Function(Action<LogLevel, String>)

    Gets a Realms.Logging.Logger.FunctionLogger that proxies Log calls to the supplied function.

    Declaration
    public static Logger Function(Action<LogLevel, string> logFunction)
    Parameters
    Type Name Description
    Action<LogLevel, String> logFunction

    Function to proxy log calls to.

    Returns
    Type Description
    Logger

    A Logger instance that will invoke logFunction for each message.

    | Improve this Doc View Source

    Function(Action<String>)

    Gets a Realms.Logging.Logger.FunctionLogger that proxies Log calls to the supplied function. The message will already be formatted with the default message formatting that includes a timestamp.

    Declaration
    public static Logger Function(Action<string> logFunction)
    Parameters
    Type Name Description
    Action<String> logFunction

    Function to proxy log calls to.

    Returns
    Type Description
    Logger

    A Logger instance that will invoke logFunction for each message.

    | Improve this Doc View Source

    Log(LogLevel, String)

    Log a message at the supplied level.

    Declaration
    public void Log(LogLevel level, string message)
    Parameters
    Type Name Description
    LogLevel level

    The criticality level for the message.

    String message

    The message to log.

    | Improve this Doc View Source

    LogImpl(LogLevel, String)

    The internal implementation being called from Log(LogLevel, String).

    Declaration
    protected abstract void LogImpl(LogLevel level, string message)
    Parameters
    Type Name Description
    LogLevel level

    The criticality level for the message.

    String message

    The message to log.

    • Improve this Doc
    • View Source
    In This Article
    Back to top Copyright © 2020 Realm
    Generated by DocFX