Class Logging
This class provides the functionality for creating logger instances and helpers for converting to/from LogLevel values.
Inherited Members
Namespace: Akka.Event
Assembly: Akka.dll
Syntax
public static class Logging
Methods
| Improve this Doc View SourceClassFor(LogLevel)
Retrieves the log event class associated with the specified log level.
Declaration
public static Type ClassFor(this LogLevel logLevel)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | logLevel | The log level used to lookup the associated class. |
Returns
Type | Description |
---|---|
Type | The log event class associated with the specified log level. |
Exceptions
Type | Condition |
---|---|
ArgumentException | The exception is thrown if the given |
GetLogger(ActorSystem, Object, ILogMessageFormatter)
Creates a new logging adapter using the specified system's event stream.
Declaration
public static ILoggingAdapter GetLogger(ActorSystem system, object logSourceObj, ILogMessageFormatter logMessageFormatter = null)
Parameters
Type | Name | Description |
---|---|---|
ActorSystem | system | The system used to configure the logging adapter. |
Object | logSourceObj | The source that produces the log events. |
ILogMessageFormatter | logMessageFormatter | The formatter used to format log messages. |
Returns
Type | Description |
---|---|
ILoggingAdapter | The newly created logging adapter. |
GetLogger(IActorContext, ILogMessageFormatter)
Creates a new logging adapter using the specified context's event stream.
Declaration
public static ILoggingAdapter GetLogger(this IActorContext context, ILogMessageFormatter logMessageFormatter = null)
Parameters
Type | Name | Description |
---|---|---|
IActorContext | context | The context used to configure the logging adapter. |
ILogMessageFormatter | logMessageFormatter | The formatter used to format log messages. |
Returns
Type | Description |
---|---|
ILoggingAdapter | The newly created logging adapter. |
GetLogger(LoggingBus, Object, ILogMessageFormatter)
Creates a new logging adapter that writes to the specified logging bus.
Declaration
public static ILoggingAdapter GetLogger(LoggingBus loggingBus, object logSourceObj, ILogMessageFormatter logMessageFormatter = null)
Parameters
Type | Name | Description |
---|---|---|
LoggingBus | loggingBus | The bus on which this logger writes. |
Object | logSourceObj | The source that produces the log events. |
ILogMessageFormatter | logMessageFormatter | The formatter used to format log messages. |
Returns
Type | Description |
---|---|
ILoggingAdapter | The newly created logging adapter. |
LogLevelFor(String)
Retrieves the log level from the specified string.
Declaration
public static LogLevel LogLevelFor(string logLevel)
Parameters
Type | Name | Description |
---|---|---|
String | logLevel | The string representation of the log level to lookup. |
Returns
Type | Description |
---|---|
LogLevel | The log level that matches the specified string. |
Exceptions
Type | Condition |
---|---|
ArgumentException | The exception is thrown if the given |
LogLevelFor<T>()
Retrieves the log level associated with the specified T
.
Declaration
public static LogLevel LogLevelFor<T>()
where T : LogEvent
Returns
Type | Description |
---|---|
LogLevel | The log level associated with the specified LogEvent type. |
Type Parameters
Name | Description |
---|---|
T | The type of the log event. |
Exceptions
Type | Condition |
---|---|
ArgumentException | The exception is thrown if the given |
SimpleName(Object)
Returns a "safe" LogSource name for the provided object's type.
Declaration
public static string SimpleName(object o)
Parameters
Type | Name | Description |
---|---|---|
Object | o |
Returns
Type | Description |
---|---|
String | The simple name of the given object's Type. |
SimpleName(Type)
Returns a "safe" LogSource for the provided type.
Declaration
public static string SimpleName(Type t)
Parameters
Type | Name | Description |
---|---|---|
Type | t |
Returns
Type | Description |
---|---|
String | A usable simple LogSource name. |
StringFor(LogLevel)
Retrieves the log event class name associated with the specified log level.
Declaration
public static string StringFor(this LogLevel logLevel)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | logLevel | The log level used to lookup the associated class. |
Returns
Type | Description |
---|---|
String | The log event class name associated with the specified log level. |
Exceptions
Type | Condition |
---|---|
ArgumentException | The exception is thrown if the given |