Message Levels

Message levels in SciMLLogging determine the severity and importance of log messages. Understanding these levels is essential for configuring appropriate verbosity in your applications.

Overview

SciMLLogging provides a hierarchy of message levels that correspond to different types of information:

SciMLLogging.AbstractMessageLevelType
AbstractMessageLevel

Abstract base type for all verbosity log levels in SciMLLogging.

Log levels determine the severity/importance of messages. Concrete subtypes include:

  • Silent: No output
  • DebugLevel: Debug messages
  • InfoLevel: Informational messages
  • WarnLevel: Warning messages
  • ErrorLevel: Error messages
  • CustomLevel(n): Custom log level with integer value n
source

Each of the AbstractMessageLevels correspond to a Julia Logging LogLevel type with an associated integer, besides Silent. See the Julia Logging documentation for more details.

Standard Message Levels

Silent Level

SciMLLogging.SilentType
Silent <: AbstractMessageLevel

Log level that produces no output. When a message category is set to Silent(), no messages will be emitted for that category.

source

The Silent level is special - it completely suppresses output for a message. As such, it does not have an associated LogLevel.

Debug Level

SciMLLogging.DebugLevelType
DebugLevel <: AbstractMessageLevel

Debug log level. Messages at this level provide detailed debugging information, typically more verbose than informational messages. Useful for development and troubleshooting.

Corresponds to Logging.Debug == Logging.LogLevel(-1000) when using the Logging backend.

By default, these messages are not logged at all, and the JULIA_DEBUG environment variable needs to be set. For details see the Julia Logging documentation.

source

DebugLevel() is for messages with a very low priority. By default, these messages are not logged at all, and the JULIA_DEBUG environment variable needs to be set. For details see the Julia Logging documentation.

Information Level

SciMLLogging.InfoLevelType
InfoLevel <: AbstractMessageLevel

Informational log level. Messages at this level provide general information about the progress or state of the computation.

Corresponds to Logging.Info == Logging.LogLevel(0) when using the Logging backend.

source

Use InfoLevel() for general status updates, progress information, and routine diagnostic messages that users might want to see during normal operation.

Warning Level

SciMLLogging.WarnLevelType
WarnLevel <: AbstractMessageLevel

Warning log level. Messages at this level indicate potential issues or situations that may require attention but don't prevent execution.

Corresponds to Logging.Warn == Logging.LogLevel(1000) when using the Logging backend.

source

WarnLevel() should be used for potentially problematic situations that don't prevent execution but may require user attention.

Error Level

SciMLLogging.ErrorLevelType
ErrorLevel <: AbstractMessageLevel

Error log level. Messages at this level indicate serious problems or failures in the computation.

Corresponds to Logging.Warn == Logging.LogLevel(2000) when using the Logging backend.

source

ErrorLevel() is reserved for serious problems and failures that indicate something has gone wrong in the computation.

Custom Message Levels

SciMLLogging.CustomLevelType
CustomLevel(n::Int) <: AbstractMessageLevel

Custom log level with integer value n. This allows creating custom severity levels beyond the standard Info/Warn/Error hierarchy.

Corresponds to Logging.LogLevel(n), where n is any integer, when using the Logging backend.

Higher integer values typically indicate higher priority/severity.

Example

debug_level = CustomLevel(-1000)  # Very low priority debug messages
critical_level = CustomLevel(1000)  # Very high priority critical messages
source

Custom levels provide flexibility for specialized use cases where the standard Info/Warn/Error hierarchy isn't sufficient.

Usage Examples

using SciMLLogging

# Standard levels
debug_level = DebugLevel()
info_level = InfoLevel()
warn_level = WarnLevel()
error_level = ErrorLevel()
silent_level = Silent()

# Custom levels for specialized needs
trace_level = CustomLevel(-500)     # Low priority debugging
critical_level = CustomLevel(2000)  # Higher than standard error level

Level Hierarchy

The message levels have a natural hierarchy that affects logging behavior:

  • Silent(): No output (always suppressed)
  • DebugLevel(): Lowest priority message
  • InfoLevel(): Low priority for general information
  • WarnLevel(): Medium priority
  • ErrorLevel(): Highest standard priority
  • CustomLevel(n): Priority determined by integer value n

Higher priority messages are more likely to be displayed by logging systems, while lower priority messages may be filtered out depending on the logger configuration.