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
NameDescription
minimumLogLevelLogLevel

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

maximumEntryCountint

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

clockIClock

Optional IClock; will use the system clock if null.

Properties

LogEntries

public IList<string> LogEntries { get; }

The list of log entries.

Property Value
TypeDescription
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
NameDescription
typeType

The type from which entries are being logged.

Returns
TypeDescription
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
NameDescription
logLevelLogLevel

The LogLevel of this log entry.

formattedMessagestring

The fully formatted log message, ready for logging.

Overrides

Extension Method