Logger class
Central logger with color + formatting controls.
Gallery walkthrough. Browser consoles omit ANSI colors; release logging defaults to disabled.
Configure development messages
import 'package:activity/activity.dart';
void main() {
final logger = Logger(printInRelease: false, enableColors: false);
logger.info('Ready'); // No user records or credentials in diagnostics.
}
Silence optional diagnostics
import 'package:activity/activity.dart';
void main() {
final logger = Logger(enabled: false);
logger.warn('This optional diagnostic is disabled.');
}
Constructors
Properties
- enableColors ↔ bool
-
Use ANSI colors when supported. (On web, we just keep plain text.)
getter/setter pair
- enabled ↔ bool
-
Master switch.
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- includeTimestamp ↔ bool
-
Include ISO-ish timestamp prefix.
getter/setter pair
- nameWidth → int
-
Pads the
namefield to align messages.final - printInRelease ↔ bool
-
If false, suppress logs in release mode.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
error(
String text, {String name = '📕 error', Object? error, StackTrace? stackTrace}) → void -
info(
String text, {String name = '📘 info'}) → void -
log(
LogLevel level, String message, {String name = '', Object? error, StackTrace? stackTrace}) → void -
normal(
String text, {String name = '📓 normal'}) → void -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
success(
String text, {String name = '📗 success'}) → void -
toString(
) → String -
A string representation of this object.
inherited
-
warn(
String text, {String name = '📙 warning'}) → void
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited