Show / Hide Table of Contents

Class BaseLogger

An abstract base logger, upon which real loggers may be built.

Inheritance
System.Object
BaseLogger
ConsoleLogger
MemoryLogger
Implements
ILogger
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Google.Apis.Logging
Assembly: Google.Apis.Core.dll
Syntax
public abstract class BaseLogger : ILogger

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.

System.Type forType

The type from which entries are being logged. May be null.

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
System.Boolean

IsErrorEnabled

Is error level logging enabled?

Declaration
public bool IsErrorEnabled { get; }
Property Value
Type Description
System.Boolean

IsInfoEnabled

Is info level logging enabled?

Declaration
public bool IsInfoEnabled { get; }
Property Value
Type Description
System.Boolean

IsWarningEnabled

Is warning level logging enabled?

Declaration
public bool IsWarningEnabled { get; }
Property Value
Type Description
System.Boolean

LoggerForType

The type from which entries are being logged. May be null.

Declaration
public Type LoggerForType { get; }
Property Value
Type Description
System.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
System.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, Object[])

Logs a debug message.

Declaration
public void Debug(string message, params object[] formatArgs)
Parameters
Type Name Description
System.String message

The message to log.

System.Object[] formatArgs

String.Format arguments (if applicable).

Error(Exception, String, Object[])

Logs an error message resulting from an exception.

Declaration
public void Error(Exception exception, string message, params object[] formatArgs)
Parameters
Type Name Description
System.Exception exception
System.String message

The message to log.

System.Object[] formatArgs

String.Format arguments (if applicable).

Error(String, Object[])

Logs an error message.

Declaration
public void Error(string message, params object[] formatArgs)
Parameters
Type Name Description
System.String message

The message to log.

System.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
System.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, Object[])

Logs an info message.

Declaration
public void Info(string message, params object[] formatArgs)
Parameters
Type Name Description
System.String message

The message to log.

System.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.

System.String formattedMessage

The fully formatted log message, ready for logging.

Warning(String, Object[])

Logs a warning.

Declaration
public void Warning(string message, params object[] formatArgs)
Parameters
Type Name Description
System.String message

The message to log.

System.Object[] formatArgs

String.Format arguments (if applicable).

Implements

ILogger

Extension Methods

Utilities.ThrowIfNull<T>(T, String)
Back to top