Dart API ReferenceloggingLevel

Level class

Levels to control logging output. Logging can be enabled to include all levels above certain Level. Levels are ordered using an integer value Level.value. The predefined Level constants below are sorted as follows (in descending order): Level.SHOUT, Level.SEVERE, Level.WARNING, Level.INFO, Level.CONFIG, Level.FINE, Level.FINER, Level.FINEST, and Level.ALL.

We recommend using one of the predefined logging levels. If you define your own level, make sure you use a value between those used in Level.ALL and Level.OFF.

class Level implements Comparable {

  // TODO(sigmund): mark name/value as 'const' when the language supports it.
  final String name;

  /**
   * Unique value for this level. Used to order levels, so filtering can exclude
   * messages whose level is under certain value.
   */
  final int value;

  const Level(this.name, this.value);

  /** Special key to turn on logging for all levels ([value] = 0). */
  static const Level ALL = const Level('ALL', 0);

  /** Special key to turn off all logging ([value] = 2000). */
  static const Level OFF = const Level('OFF', 2000);

  /** Key for highly detailed tracing ([value] = 300). */
  static const Level FINEST = const Level('FINEST', 300);

  /** Key for fairly detailed tracing ([value] = 400). */
  static const Level FINER = const Level('FINER', 400);

  /** Key for tracing information ([value] = 500). */
  static const Level FINE = const Level('FINE', 500);

  /** Key for static configuration messages ([value] = 700). */
  static const Level CONFIG = const Level('CONFIG', 700);

  /** Key for informational messages ([value] = 800). */
  static const Level INFO = const Level('INFO', 800);

  /** Key for potential problems ([value] = 900). */
  static const Level WARNING = const Level('WARNING', 900);

  /** Key for serious failures ([value] = 1000). */
  static const Level SEVERE = const Level('SEVERE', 1000);

  /** Key for extra debugging loudness ([value] = 1200). */
  static const Level SHOUT = const Level('SHOUT', 1200);

  bool operator ==(Level other) => other != null && value == other.value;
  bool operator <(Level other) => value < other.value;
  bool operator <=(Level other) => value <= other.value;
  bool operator >(Level other) => value > other.value;
  bool operator >=(Level other) => value >= other.value;
  int compareTo(Level other) => value - other.value;
  int get hashCode => value;
  String toString() => name;
}

Implements

Comparable

Static Properties

const Level ALL #

Special key to turn on logging for all levels (value = 0).

static const Level ALL = const Level('ALL', 0);

const Level CONFIG #

Key for static configuration messages (value = 700).

static const Level CONFIG = const Level('CONFIG', 700);

const Level FINE #

Key for tracing information (value = 500).

static const Level FINE = const Level('FINE', 500);

const Level FINER #

Key for fairly detailed tracing (value = 400).

static const Level FINER = const Level('FINER', 400);

const Level FINEST #

Key for highly detailed tracing (value = 300).

static const Level FINEST = const Level('FINEST', 300);

const Level INFO #

Key for informational messages (value = 800).

static const Level INFO = const Level('INFO', 800);

const Level OFF #

Special key to turn off all logging (value = 2000).

static const Level OFF = const Level('OFF', 2000);

const Level SEVERE #

Key for serious failures (value = 1000).

static const Level SEVERE = const Level('SEVERE', 1000);

const Level SHOUT #

Key for extra debugging loudness (value = 1200).

static const Level SHOUT = const Level('SHOUT', 1200);

const Level WARNING #

Key for potential problems (value = 900).

static const Level WARNING = const Level('WARNING', 900);

Constructors

const Level(String name, int value) #

const Level(this.name, this.value);

Properties

final int hashCode #

Get a hash code for this object.

All objects have hash codes. Hash codes are guaranteed to be the same for objects that are equal when compared using the equality operator ==. Other than that there are no guarantees about the hash codes. They will not be consistent between runs and there are no distribution guarantees.

If a subclass overrides hashCode it should override the equality operator as well to maintain consistency.

docs inherited from Object
int get hashCode => value;

final String name #

final String name;

final int value #

Unique value for this level. Used to order levels, so filtering can exclude messages whose level is under certain value.

final int value;

Operators

bool operator <(Level other) #

bool operator <(Level other) => value < other.value;

bool operator <=(Level other) #

bool operator <=(Level other) => value <= other.value;

bool operator >(Level other) #

bool operator >(Level other) => value > other.value;

bool operator >=(Level other) #

bool operator >=(Level other) => value >= other.value;

bool operator ==(Level other) #

The equality operator.

The default behavior for all Objects is to return true if and only if this and other are the same object.

If a subclass overrides the equality operator it should override the hashCode method as well to maintain consistency.

docs inherited from Object
bool operator ==(Level other) => other != null && value == other.value;

Methods

int compareTo(Level other) #

Compares this object to another Comparable

Returns a value like a Comparator when comparing this to other.

May throw an ArgumentError if other is of a type that is not comparable to this.

docs inherited from Comparable
int compareTo(Level other) => value - other.value;

String toString() #

Returns a string representation of this object.

docs inherited from Object
String toString() => name;