Level class

Severity level of the record used to controls output of particular logger.

There are 5 predefined levels: Level.fatal, Level.danger, Level.warning, Level.info and Level.debug (sorted in ascending order by their values).

To prevent logger from emitting any records set Logger.level to Level.off.

To emit records with any severity level by logger set Logger.level to Level.all.

User-defined severity levels are also supported. Use Level constructor to define a new severity level. Make sure that defined level's unique value is between 0x0 (Level.all) and 0xffff (Level.off); and does not overlap with 0x100, 0x200, 0x300, 0x400, 0x500 and 0x600 reserved for debug, info, warning, danger and fatal levels respectively.

Implemented types

Constructors

Level({required String name, required int value})
const

Properties

hashCode int
The hash code for this object.
no setteroverride
name String
User-readable name of this severity level.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
value int
Unique value for this severity level.
final

Methods

compareTo(Level otherLevel) int
Compares this object to another object.
override
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 <(Level otherLevel) bool
operator <=(Level otherLevel) bool
operator ==(Object other) bool
The equality operator.
override
operator >(Level otherLevel) bool
operator >=(Level otherLevel) bool

Constants

all → const Level
Special level value used to allow records with any severity level to be emitted by logger.
danger → const Level
A severity level for danger records; often records with the error level used to notify about fatal error in the operation without impact on the stability of a service or an application.
debug → const Level
A severity level for debugging records; often records with debug level used to provide diagnostic information useful in development, testing, etc., such records are usually discarded in production.
fatal → const Level
A severity level for fatal records; often after records with fatal severity level follows application process end e.g. exit(1).
info → const Level
A severity level for informative records; often records with info level used to provide general purpose information such as start/stop of service, etc.
off → const Level
Special level value to disable logger output.
warning → const Level
A severity level for warning records; often records with the warning level used to notify about events that may potentially cause application oddities.