Class MemoryLogger (1.60.0)

public sealed class MemoryLogger : BaseLogger, ILogger

A logger than logs to an in-memory buffer. Generally for use during tests.

Inheritance

object > BaseLogger > MemoryLogger

Implements

ILogger

Namespace

GoogleApisLogging

Assembly

Google.Apis.Core.dll

Constructors

MemoryLogger(LogLevel, int, IClock)

public MemoryLogger(LogLevel minimumLogLevel, int maximumEntryCount = 1000, IClock clock = null)

Construct a MemoryLogger.

Parameters
Name Description
minimumLogLevel LogLevel

Logging will be enabled at this level and all higher levels.

maximumEntryCount int

The maximum number of log entries. Further log entries will be silently discarded.

clock IClock

Optional IClock; will use the system clock if null.

Properties

LogEntries

public IList<string> LogEntries { get; }

The list of log entries.

Property Value
Type Description
IListstring

Methods

BuildNewLogger(Type)

protected override ILogger BuildNewLogger(Type type)

Build a new logger of the derived concrete type, for use to log from the specified type.

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

Overrides

Log(LogLevel, string)

protected override void Log(LogLevel logLevel, string formattedMessage)

Perform the actual logging.

Parameters
Name Description
logLevel LogLevel

The LogLevel of this log entry.

formattedMessage string

The fully formatted log message, ready for logging.

Overrides

Extension Method