Logger class

Singleton logger that writes all output to stderr.

Usage:

Logger.init(); // Call once at startup
Logger.info('Server started');
Logger.error('Something failed', error, stackTrace);

Configure via the LOG_LEVEL environment variable:

  • debug — verbose output for development
  • info — default; general operational messages
  • warn — potential issues that are non-fatal
  • error — failures that need attention

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

level LogLevel
Current log level. Can be overridden programmatically (useful in tests).
getter/setter pair

Static Methods

debug(String message) → void
Log a debug-level message.
error(String message, [Object? error, StackTrace? stackTrace]) → void
Log an error-level message with an optional error and stackTrace.
info(String message) → void
Log an info-level message.
init() → void
Initialise the logger from the LOG_LEVEL environment variable.
warn(String message) → void
Log a warning-level message.