Class Log
Log utility class.
Inheritance
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public class Log
Properties
DefaultLogLevel
Gets or sets the default log level.
Declaration
public static LogLevel DefaultLogLevel { get; set; }
Property Value
Type | Description |
---|---|
LogLevel |
IsDebugEnabled
Gets a value indicating whether logging is enabled for debug-level messages for at least one of the registered providers.
Declaration
public static bool IsDebugEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsErrorEnabled
Gets a value indicating whether logging is enabled for error-level messages for at least one of the registered providers.
Declaration
public static bool IsErrorEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsFatalEnabled
Gets a value indicating whether logging is enabled for fatal-level messages for at least one of the registered providers.
Declaration
public static bool IsFatalEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsInfoEnabled
Gets a value indicating whether logging is enabled for info-level messages for at least one of the registered providers.
Declaration
public static bool IsInfoEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsVerboseEnabled
Gets a value indicating whether logging is enabled for verbose-level messages for at least one of the registered providers.
Declaration
public static bool IsVerboseEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
IsWarnEnabled
Gets a value indicating whether logging is enabled for warn-level messages for at least one of the registered providers.
Declaration
public static bool IsWarnEnabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
LogLevel
Gets or sets the default log level.
Declaration
[Obsolete("Use DefaultLogLevel instead.")]
public static LogLevel LogLevel { get; set; }
Property Value
Type | Description |
---|---|
LogLevel |
Provider
Gets or sets the first log provider.
Declaration
public static LogProvider Provider { get; set; }
Property Value
Type | Description |
---|---|
LogProvider |
Providers
Gets the log providers.
Declaration
public static LogProvider[] Providers { get; }
Property Value
Type | Description |
---|---|
LogProvider[] |
Methods
AddProvider(LogProvider)
Registers a log provider as a logging target. Alias for RegisterProvider.
Declaration
public static void AddProvider(LogProvider provider)
Parameters
Type | Name | Description |
---|---|---|
LogProvider | provider | The new provider. |
AddProvider(LogProvider, LogLevel)
Registers a log provider as a logging target, setting its log level in the process. Alias for RegisterProvider.
Declaration
public static void AddProvider(LogProvider provider, LogLevel level)
Parameters
Type | Name | Description |
---|---|---|
LogProvider | provider | The new provider. |
LogLevel | level | The log level. |
Debug(String)
Logs a debug-level message.
Declaration
public static void Debug(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
Debug(String, Exception)
Logs a debug-level message.
Declaration
public static void Debug(string message, Exception ex)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
System.Exception | ex | The exception. |
Error(String)
Logs an error-level message.
Declaration
public static void Error(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
Error(String, Exception)
Logs an error-level message.
Declaration
public static void Error(string message, Exception ex)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
System.Exception | ex | The exception. |
Fatal(String)
Logs a fatal-level message.
Declaration
public static void Fatal(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
Fatal(String, Exception)
Logs a fatal-level message.
Declaration
public static void Fatal(string message, Exception ex)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
System.Exception | ex | The exception. |
Flush()
Blocks until all logs are written out.
Declaration
public static void Flush()
GetLogger(String)
Get a logger for a specific Tag.
Declaration
public static ILog GetLogger(string tag)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | The tag to log to. |
Returns
Type | Description |
---|---|
ILog | A ILog that will log to the specified tag. |
GetLogger(String, LogLevel)
Get a logger for a specific Tag.
Declaration
public static ILog GetLogger(string tag, LogLevel level)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | The tag to log to. |
LogLevel | level | Logger's default log level. |
Returns
Type | Description |
---|---|
ILog | A ILog that will log to the specified tag. |
GetLogger(Type)
Get a logger for a specific Tag. The tag is taken from the class namespace and name.
Declaration
public static ILog GetLogger(Type type)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type to use as the tag. |
Returns
Type | Description |
---|---|
ILog | A ILog that will log to the specified tag. |
GetLogger(Type, LogLevel)
Get a logger for a specific Tag. The tag is taken from the class namespace and name.
Declaration
public static ILog GetLogger(Type type, LogLevel level)
Parameters
Type | Name | Description |
---|---|---|
System.Type | type | The type to use as the tag. |
LogLevel | level | Logger's default log level. |
Returns
Type | Description |
---|---|
ILog | A ILog that will log to the specified tag. |
Info(String)
Logs an info-level message.
Declaration
public static void Info(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
Info(String, Exception)
Logs an info-level message.
Declaration
public static void Info(string message, Exception ex)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
System.Exception | ex | The exception. |
RegisterProvider(LogProvider)
Registers a log provider as a logging target.
Declaration
public static void RegisterProvider(LogProvider provider)
Parameters
Type | Name | Description |
---|---|---|
LogProvider | provider | The provider. |
RegisterProvider(LogProvider, LogLevel)
Registers a log provider as a logging target, setting its log level in the process.
Declaration
public static void RegisterProvider(LogProvider provider, LogLevel level)
Parameters
Type | Name | Description |
---|---|---|
LogProvider | provider | The provider. |
LogLevel | level | The log level. |
RemoveProvider(LogProvider)
Unregisters a log provider as a logging target. Alias for UnregisterProvider.
Declaration
public static bool RemoveProvider(LogProvider provider)
Parameters
Type | Name | Description |
---|---|---|
LogProvider | provider | The provider. |
Returns
Type | Description |
---|---|
System.Boolean |
RemoveProviders()
Unregisters all log providers as logging targets. Alias for UnregisterProviders.
Declaration
public static void RemoveProviders()
SetTagOverride(String, LogLevel)
Override the default log level for a specific tag.
Declaration
public static void SetTagOverride(string tag, LogLevel level)
Parameters
Type | Name | Description |
---|---|---|
System.String | tag | The Tag to set the log level to. |
LogLevel | level | The new loglevel to use. |
UnregisterProvider(LogProvider)
Unregisters a log provider as a logging target.
Declaration
public static bool UnregisterProvider(LogProvider provider)
Parameters
Type | Name | Description |
---|---|---|
LogProvider | provider | The provider. |
Returns
Type | Description |
---|---|
System.Boolean |
UnregisterProviders()
Unregisters all log providers as logging targets.
Declaration
public static void UnregisterProviders()
Verbose(String)
Logs a verbose-level message.
Declaration
public static void Verbose(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
Verbose(String, Exception)
Logs a verbose-level message.
Declaration
public static void Verbose(string message, Exception ex)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
System.Exception | ex | The exception. |
Warn(String)
Logs a warn-level message.
Declaration
public static void Warn(string message)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
Warn(String, Exception)
Logs a warn-level message.
Declaration
public static void Warn(string message, Exception ex)
Parameters
Type | Name | Description |
---|---|---|
System.String | message | The message. |
System.Exception | ex | The exception. |
WriteLine(String)
Writes a line of text to the log.
Declaration
public static void WriteLine(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text | The text to write to the log. |