Skip to main content

IsLoggable

Gets a value indicating whether logs at this level will be written to the logger. This is particularly useful to avoid computing log messages unnecessarily.

def IsLoggable(
context: context.Context,
level: Level
) - > bool

Gets a value indicating whether logs at this level will be written to the logger. This is particularly useful to avoid computing log messages unnecessarily.

Parameters

NameTypeDescription
contextcontext.ContextThe context for the log operation, typically used for tracing or cancellation.
levelLevelThe logging level to check against the current logger configuration.

Returns

TypeDescription
boolTrue if logs at the specified level will be written, False otherwise.