Class LogLevelFilterLogger
Logger that filters out messages below certain log level.
Inheritance
Implements
Inherited Members
Namespace: Grpc.Core.Logging
Assembly: Grpc.Core.dll
Syntax
public class LogLevelFilterLogger : ILogger
Constructors
LogLevelFilterLogger(ILogger, LogLevel)
Creates and instance of LogLevelFilter.
Declaration
public LogLevelFilterLogger(ILogger logger, LogLevel logLevel)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | |
LogLevel | logLevel |
LogLevelFilterLogger(ILogger, LogLevel, Boolean)
Creates and instance of LogLevelFilter.
The fromEnvironmentVariable
parameter allows looking up "GRPC_VERBOSITY" setting provided by C-core
and uses the same log level for C# logs. Using this setting is recommended as it can prevent unintentionally hiding
C core logs requested by "GRPC_VERBOSITY" environment variable (which could happen if C# logger's log level was set to a more restrictive value).
Declaration
public LogLevelFilterLogger(ILogger logger, LogLevel defaultLogLevel, bool fromEnvironmentVariable)
Parameters
Type | Name | Description |
---|---|---|
ILogger | logger | the logger to forward filtered logs to. |
LogLevel | defaultLogLevel | the default log level, unless overriden by env variable. |
System.Boolean | fromEnvironmentVariable | if |
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 |