Show / Hide Table of Contents

Class TextWriterLogger

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

Inheritance
System.Object
TextWriterLogger
ConsoleLogger
Implements
ILogger
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Grpc.Core.Logging
Assembly: Grpc.Core.dll
Syntax
public class TextWriterLogger : ILogger

Constructors

TextWriterLogger(Func<TextWriter>)

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.

Declaration
public TextWriterLogger(Func<TextWriter> textWriterProvider)
Parameters
Type Name Description
System.Func<System.IO.TextWriter> textWriterProvider

TextWriterLogger(Func<TextWriter>, Type)

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

Declaration
protected TextWriterLogger(Func<TextWriter> textWriterProvider, Type forType)
Parameters
Type Name Description
System.Func<System.IO.TextWriter> textWriterProvider
System.Type forType

TextWriterLogger(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.

Declaration
public TextWriterLogger(TextWriter textWriter)
Parameters
Type Name Description
System.IO.TextWriter textWriter

Properties

AssociatedType

Gets the type associated with this logger.

Declaration
protected Type AssociatedType { get; }
Property Value
Type Description
System.Type

Methods

Debug(String)

Logs a message with severity Debug.

Declaration
public void Debug(string message)
Parameters
Type Name Description
System.String message
Implements
ILogger.Debug(String)

Debug(String, Object[])

Logs a formatted message with severity Debug.

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

Error(Exception, String)

Logs a message and an associated exception with severity Error.

Declaration
public void Error(Exception exception, string message)
Parameters
Type Name Description
System.Exception exception
System.String message
Implements
ILogger.Error(Exception, String)

Error(String)

Logs a message with severity Error.

Declaration
public void Error(string message)
Parameters
Type Name Description
System.String message
Implements
ILogger.Error(String)

Error(String, Object[])

Logs a formatted message with severity Error.

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

ForType<T>()

Returns a logger associated with the specified type.

Declaration
public virtual ILogger ForType<T>()
Returns
Type Description
ILogger
Type Parameters
Name Description
T
Implements
ILogger.ForType<T>()

Info(String)

Logs a message with severity Info.

Declaration
public void Info(string message)
Parameters
Type Name Description
System.String message
Implements
ILogger.Info(String)

Info(String, Object[])

Logs a formatted message with severity Info.

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

Warning(Exception, String)

Logs a message and an associated exception with severity Warning.

Declaration
public void Warning(Exception exception, string message)
Parameters
Type Name Description
System.Exception exception
System.String message
Implements
ILogger.Warning(Exception, String)

Warning(String)

Logs a message with severity Warning.

Declaration
public void Warning(string message)
Parameters
Type Name Description
System.String message
Implements
ILogger.Warning(String)

Warning(String, Object[])

Logs a formatted message with severity Warning.

Declaration
public void Warning(string format, params object[] formatArgs)
Parameters
Type Name Description
System.String format
System.Object[] formatArgs
Implements
ILogger.Warning(String, Object[])
Back to top