Class BaseLogger
An abstract base logger, upon which real loggers may be built.
Inherited Members
Namespace: Google.Apis.Logging
Assembly: Google.Apis.Core.dll
Syntax
public abstract class BaseLogger
Constructors
BaseLogger(LogLevel, IClock, Type)
Construct a BaseLogger.
Declaration
protected BaseLogger(LogLevel minimumLogLevel, IClock clock, Type forType)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | minimumLogLevel | Logging will be enabled at this level and all higher levels. |
IClock | clock | The IClock to use to timestamp log entries. |
Type | forType | The type from which entries are being logged. May be |
Properties
Clock
The IClock being used to timestamp log entries.
Declaration
public IClock Clock { get; }
Property Value
Type | Description |
---|---|
IClock |
IsDebugEnabled
Is Debug level logging enabled?
Declaration
public bool IsDebugEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
IsErrorEnabled
Is error level logging enabled?
Declaration
public bool IsErrorEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
IsInfoEnabled
Is info level logging enabled?
Declaration
public bool IsInfoEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
IsWarningEnabled
Is warning level logging enabled?
Declaration
public bool IsWarningEnabled { get; }
Property Value
Type | Description |
---|---|
bool |
LoggerForType
The type from which entries are being logged. May be null
.
Declaration
public Type LoggerForType { get; }
Property Value
Type | Description |
---|---|
Type |
MinimumLogLevel
Logging is enabled at this level and all higher levels.
Declaration
public LogLevel MinimumLogLevel { get; }
Property Value
Type | Description |
---|---|
LogLevel |
Methods
BuildNewLogger(Type)
Build a new logger of the derived concrete type, for use to log from the specified type.
Declaration
protected abstract ILogger BuildNewLogger(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | The type from which entries are being logged. |
Returns
Type | Description |
---|---|
ILogger | A new ILogger instance, logging from the specified type. |
Debug(string, params object[])
Logs a debug message.
Declaration
public void Debug(string message, params object[] formatArgs)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message to log. |
object[] | formatArgs | String.Format arguments (if applicable). |
Error(Exception, string, params object[])
Logs an error message resulting from an exception.
Declaration
public void Error(Exception exception, string message, params object[] formatArgs)
Parameters
Type | Name | Description |
---|---|---|
Exception | exception | |
string | message | The message to log. |
object[] | formatArgs | String.Format arguments (if applicable). |
Error(string, params object[])
Logs an error message.
Declaration
public void Error(string message, params object[] formatArgs)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message to log. |
object[] | formatArgs | String.Format arguments (if applicable). |
ForType(Type)
Returns a logger which will be associated with the specified type.
Declaration
public ILogger ForType(Type type)
Parameters
Type | Name | Description |
---|---|---|
Type | type | Type to which this logger belongs. |
Returns
Type | Description |
---|---|
ILogger | A type-associated logger. |
ForType<T>()
Returns a logger which will be associated with the specified type.
Declaration
public ILogger ForType<T>()
Returns
Type | Description |
---|---|
ILogger | A type-associated logger. |
Type Parameters
Name | Description |
---|---|
T |
Info(string, params object[])
Logs an info message.
Declaration
public void Info(string message, params object[] formatArgs)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message to log. |
object[] | formatArgs | String.Format arguments (if applicable). |
Log(LogLevel, string)
Perform the actual logging.
Declaration
protected abstract void Log(LogLevel logLevel, string formattedMessage)
Parameters
Type | Name | Description |
---|---|---|
LogLevel | logLevel | The LogLevel of this log entry. |
string | formattedMessage | The fully formatted log message, ready for logging. |
Warning(string, params object[])
Logs a warning.
Declaration
public void Warning(string message, params object[] formatArgs)
Parameters
Type | Name | Description |
---|---|---|
string | message | The message to log. |
object[] | formatArgs | String.Format arguments (if applicable). |