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 log level to check for loggability.

Returns​

TypeDescription
boolA boolean indicating if the specified log level is currently loggable.