Class RealmLogger
A logger that logs messages originating from Realm. The default logger can be replaced by setting Default.
A few built-in implementations are provided by Console, Null, and Function(Action<string>),
but you can implement your own.
Namespace: Realms.Logging
Assembly: Realm.dll
Syntax
public abstract class RealmLogger
Constructors
| Edit this page View SourceRealmLogger()
Initializes a new instance of the Realm
Declaration
protected RealmLogger()
Properties
| Edit this page View SourceConsole
Gets a Realm
Declaration
public static RealmLogger Console { get; }
Property Value
Type | Description |
---|---|
Realm |
A Realm |
Default
Gets or sets a custom Realm
Declaration
public static RealmLogger Default { get; set; }
Property Value
Type | Description |
---|---|
Realm |
The logger to be used for Realm-originating messages. |
LogLevel
Gets or sets the verbosity of log messages for all log categories via Realm.
Declaration
[Obsolete("Use GetLogLevel() and SetLogLevel().")]
public static LogLevel LogLevel { get; set; }
Property Value
Type | Description |
---|---|
Log |
The log level for Realm-originating messages. |
Null
Gets a Realm
Declaration
public static RealmLogger Null { get; }
Property Value
Type | Description |
---|---|
Realm |
A Realm |
Methods
| Edit this page View SourceFile(string, Encoding?)
Gets a Realm
Declaration
public static RealmLogger 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 |
---|---|
Realm |
A Realm |
Remarks
Please note that this logger is not optimized for performance, and could lead to overall sync performance slowdown with more verbose log levels.
Function(Action<LogLevel, LogCategory, string>)
Gets a Realm
Declaration
public static RealmLogger Function(Action<LogLevel, LogCategory, string> logFunction)
Parameters
Type | Name | Description |
---|---|---|
Action<Log |
logFunction | Function to proxy log calls to. |
Returns
Type | Description |
---|---|
Realm |
A Realm |
Function(Action<LogLevel, string>)
Gets a Realm
Declaration
[Obsolete("Use Function(Action<LogLevel, LogCategory, string> logFunction).")]
public static RealmLogger Function(Action<LogLevel, string> logFunction)
Parameters
Returns
Type | Description |
---|---|
Realm |
A Realm |
Function(Action<string>)
Gets a Realm
Declaration
public static RealmLogger Function(Action<string> logFunction)
Parameters
Returns
Type | Description |
---|---|
Realm |
A Realm |
GetLogLevel(LogCategory?)
Gets the verbosity of log messages for the given category.
Declaration
public static LogLevel GetLogLevel(LogCategory? category = null)
Parameters
Type | Name | Description |
---|---|---|
Log |
category | The category to get the level for. Defaults to Realm if not specified. |
Returns
Type | Description |
---|---|
Log |
The log level used for the given category. |
Log(LogLevel, LogCategory, string)
Log a message at the supplied level and category.
Declaration
public void Log(LogLevel level, LogCategory category, string message)
Parameters
Type | Name | Description |
---|---|---|
Log |
level | The criticality level for the message. |
Log |
category | The category for the message. |
string | message | The message to log. |
Log(LogLevel, string)
Log a message at the supplied level and default category SDK.
Declaration
public void Log(LogLevel level, string message)
Parameters
Type | Name | Description |
---|---|---|
Log |
level | The criticality level for the message. |
string | message | The message to log. |
LogImpl(LogLevel, LogCategory, string)
The internal implementation being called from Log(Log
Declaration
protected abstract void LogImpl(LogLevel level, LogCategory category, string message)
Parameters
Type | Name | Description |
---|---|---|
Log |
level | The criticality level for the message. |
Log |
category | The category for the message. |
string | message | The message to log. |
SetLogLevel(LogLevel, LogCategory?)
Sets the verbosity of log messages for the given category.
Declaration
public static void SetLogLevel(LogLevel level, LogCategory? category = null)
Parameters
Type | Name | Description |
---|---|---|
Log |
level | The log level to use for messages. |
Log |
category | The category to set the level for. Defaults to Realm if not specified. |