CapsaLogger class

Central logging facility used across the whole Capsa library.

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

categories Set<CapsaLogCategory>
Categories that are allowed to log. Defaults to "all".
getter/setter pair
enabled bool
Master on/off switch. Logging is OFF by default so it never affects production performance unless explicitly enabled.
getter/setter pair
history UnmodifiableListView<CapsaLogRecord>
no setter
level CapsaLogLevel
Minimum level that will be processed.
getter/setter pair
maxHistory int
In-memory ring buffer of recent log records, useful for debug overlays / CapsaLogger.history.
getter/setter pair
sink ↔ void Function(CapsaLogRecord record)?
Optional custom sink (e.g. to forward logs to Sentry, a file, or a custom in-app console). If null, print is used.
getter/setter pair

Static Methods

clearHistory() → void
debug(CapsaLogCategory c, String m, {Object? data}) → void
disable() → void
enable({CapsaLogLevel level = CapsaLogLevel.debug, Set<CapsaLogCategory>? categories}) → void
Enable logging. Optionally restrict to a set of categories and/or set a minimum level in one call.
error(CapsaLogCategory c, String m, {Object? data}) → void
info(CapsaLogCategory c, String m, {Object? data}) → void
log(CapsaLogCategory category, CapsaLogLevel level, String message, {Object? data}) → void
nextId() int
printSummary() → void
Prints a summary of how many log entries were captured per category/level - handy after running a test scenario.
verbose(CapsaLogCategory c, String m, {Object? data}) → void
warn(CapsaLogCategory c, String m, {Object? data}) → void