LogLevel enum
Defines various levels of logging severity for controlling logging output.
This enum is used to filter or categorize log messages based on their importance, relevance, or severity. Logging frameworks and tools use these levels to determine whether a message should be processed or ignored.
Levels Overview:
Level | Value | Description |
---|---|---|
trace |
0 | Detailed debugging or tracing info, typically very verbose. |
debug |
1 | General debugging information, useful for development. |
info |
2 | General runtime events (e.g., startup, shutdown). |
warning |
3 | Something unexpected, but not necessarily an error. |
error |
4 | Recoverable application errors that require attention. |
fatal |
5 | Critical issues that will likely cause application termination. |
off |
6 | Disables logging entirely. /// |
Values
- TRACE → const LogLevel
-
The most fine-grained level. Use this for tracing function calls, loop iterations, and other low-level, verbose details.
Typically disabled in production due to verbosity.
const LogLevel(0, 'TRACE')
- DEBUG → const LogLevel
-
Debug-level messages useful for developers during active debugging sessions.
Includes information like variable values, internal state, and control flow.
const LogLevel(1, 'DEBUG')
- INFO → const LogLevel
-
Informational messages that indicate the application’s progress under normal conditions.
Good for confirming that things are working as expected (e.g., "User successfully logged in").
const LogLevel(2, 'INFO')
- WARN → const LogLevel
-
Indicates a potential issue or unexpected situation, but the application can still continue safely.
Should be investigated but may not require immediate action (e.g., deprecated API usage).
const LogLevel(3, 'WARNING')
- ERROR → const LogLevel
-
An error has occurred that may impact functionality, but the app is still running.
For example, a failed network request, missing file, or service unavailability.
const LogLevel(4, 'ERROR')
- FATAL → const LogLevel
-
A critical error has occurred that is likely to lead to application failure or shutdown.
Use for fatal exceptions, data corruption, or failed application bootstrapping.
const LogLevel(5, 'FATAL')
- OFF → const LogLevel
-
Disables all logging output.
Use this to suppress all logs, useful for production environments or silent modes.
const LogLevel(6, 'OFF')
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- index → int
-
A numeric identifier for the enumerated value.
no setterinherited
- name → String
-
The display name of the log level (e.g., 'INFO', 'ERROR').
final
- name → String
-
Available on Enum, provided by the EnumName extension
The name of the enum value.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- value → int
-
Integer value for comparing levels. Lower values mean lower severity.
final
Methods
-
isEnabledFor(
LogLevel level) → bool -
Determines if this log level is enabled given a minimum
level
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited