fromValue static method
Returns the log level from the given value
.
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. /// |
Implementation
static LogLevel fromValue(String value) {
return LogLevel.values.firstWhere((e) => e.name.equalsIgnoreCase(value))
.getOrThrow("Invalid log level value: $value. Available log levels: ${LogLevel.values.map((e) => e.name).join(", ")}");
}