Class TextWriterLogger

public class TextWriterLogger : object, ILogger

Logger that logs to an arbitrary System.IO.TextWriter.

Inheritance

Object > TextWriterLogger

Implements

ILogger

Derived Types

Namespace

Grpc.Core.Logging

Assembly

Grpc.Core.dll

Constructors

TextWriterLogger(Func<TextWriter>)

public TextWriterLogger(Func<TextWriter> textWriterProvider)

Creates a console logger not associated to any specific type and writes to a System.IO.TextWriter obtained from given provider. User is responsible for providing an instance of TextWriter that is thread-safe.

Parameter
TypeNameDescription
Func<TextWriter>textWriterProvider

TextWriterLogger(Func<TextWriter>, Type)

protected TextWriterLogger(Func<TextWriter> textWriterProvider, Type forType)

Creates a console logger that logs messsage specific for given type.

Parameters
TypeNameDescription
Func<TextWriter>textWriterProvider
TypeforType

TextWriterLogger(TextWriter)

public TextWriterLogger(TextWriter textWriter)

Creates a console logger not associated to any specific type and writes to given System.IO.TextWriter. User is responsible for providing an instance of TextWriter that is thread-safe.

Parameter
TypeNameDescription
TextWritertextWriter

Properties

AssociatedType

protected Type AssociatedType { get; }

Gets the type associated with this logger.

Property Value
TypeDescription
Type

Methods

Debug(String)

public void Debug(string message)

Logs a message with severity Debug.

Parameter
TypeNameDescription
Stringmessage

Debug(String, Object[])

public void Debug(string format, params object[] formatArgs)

Logs a formatted message with severity Debug.

Parameters
TypeNameDescription
Stringformat
Object[]formatArgs

Error(Exception, String)

public void Error(Exception exception, string message)

Logs a message and an associated exception with severity Error.

Parameters
TypeNameDescription
Exceptionexception
Stringmessage

Error(String)

public void Error(string message)

Logs a message with severity Error.

Parameter
TypeNameDescription
Stringmessage

Error(String, Object[])

public void Error(string format, params object[] formatArgs)

Logs a formatted message with severity Error.

Parameters
TypeNameDescription
Stringformat
Object[]formatArgs

ForType<T>()

public virtual ILogger ForType<T>()

Returns a logger associated with the specified type.

Returns
TypeDescription
ILogger
Type Parameter
NameDescription
T

Info(String)

public void Info(string message)

Logs a message with severity Info.

Parameter
TypeNameDescription
Stringmessage

Info(String, Object[])

public void Info(string format, params object[] formatArgs)

Logs a formatted message with severity Info.

Parameters
TypeNameDescription
Stringformat
Object[]formatArgs

Warning(Exception, String)

public void Warning(Exception exception, string message)

Logs a message and an associated exception with severity Warning.

Parameters
TypeNameDescription
Exceptionexception
Stringmessage

Warning(String)

public void Warning(string message)

Logs a message with severity Warning.

Parameter
TypeNameDescription
Stringmessage

Warning(String, Object[])

public void Warning(string format, params object[] formatArgs)

Logs a formatted message with severity Warning.

Parameters
TypeNameDescription
Stringformat
Object[]formatArgs

Implements