Class TextWriterLogger
Logger that logs to an arbitrary System.IO.TextWriter.
Implements
Inherited Members
Namespace: Grpc.Core.Logging
Assembly: Grpc.Core.dll
Syntax
public class TextWriterLogger : ILoggerConstructors
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 | 
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 | 
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 | 
Error(String)
Logs a message with severity Error.
Declaration
public void Error(string message)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | message | 
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 | 
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 | 
Info(String)
Logs a message with severity Info.
Declaration
public void Info(string message)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | message | 
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 | 
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 | 
Warning(String)
Logs a message with severity Warning.
Declaration
public void Warning(string message)Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | message | 
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 |