Show / Hide Table of Contents

Class LogLevelFilterLogger

Logger that filters out messages below certain log level.

Inheritance
System.Object
LogLevelFilterLogger
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 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 true, override log level with setting from environment variable.

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