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.AbstractMessageLevel — TypeAbstractMessageLevelAbstract base type for all verbosity log levels in SciMLLogging.
Log levels determine the severity/importance of messages. Concrete subtypes include:
Silent: No outputDebugLevel: Debug messagesInfoLevel: Informational messagesWarnLevel: Warning messagesErrorLevel: Error messagesCustomLevel(n): Custom log level with integer valuen
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.Silent — TypeSilent <: AbstractMessageLevelLog level that produces no output. When a message category is set to Silent(), no messages will be emitted for that category.
The Silent level is special - it completely suppresses output for a message. As such, it does not have an associated LogLevel.
Debug Level
SciMLLogging.DebugLevel — TypeDebugLevel <: AbstractMessageLevelDebug 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.
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.InfoLevel — TypeInfoLevel <: AbstractMessageLevelInformational 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.
Use InfoLevel() for general status updates, progress information, and routine diagnostic messages that users might want to see during normal operation.
Warning Level
SciMLLogging.WarnLevel — TypeWarnLevel <: AbstractMessageLevelWarning 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.
WarnLevel() should be used for potentially problematic situations that don't prevent execution but may require user attention.
Error Level
SciMLLogging.ErrorLevel — TypeErrorLevel <: AbstractMessageLevelError 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.
ErrorLevel() is reserved for serious problems and failures that indicate something has gone wrong in the computation.
Custom Message Levels
SciMLLogging.CustomLevel — TypeCustomLevel(n::Int) <: AbstractMessageLevelCustom 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 messagesCustom 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 levelLevel Hierarchy
The message levels have a natural hierarchy that affects logging behavior:
Silent(): No output (always suppressed)DebugLevel(): Lowest priority messageInfoLevel(): Low priority for general informationWarnLevel(): Medium priorityErrorLevel(): Highest standard priorityCustomLevel(n): Priority determined by integer valuen
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.