cobalt_logging 0.5.0
cobalt_logging: ^0.5.0 copied to clipboard
Cobalt adapter for package:logging — sends the DI graph's events to a dart.dev Logger.
cobalt_logging #
Adapter for package:logging, the dart.dev one, for Cobalt.
Not
cobalt_logger. That adapts package:logger, a different package whose name differs by one letter. This one is for the dart.devlogging.
Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((record) => print(record));
final scope = await CobaltApplication.start(
root: const AppScope(),
observers: [CobaltLogObserver(CobaltLoggingSink())],
);
package:logging routes rather than prints, so nothing appears until something listens — the
two lines above are not optional decoration.
Levels #
| Cobalt | logging |
|---|---|
trace |
FINEST |
debug |
FINE |
info |
INFO |
warning |
WARNING |
error |
SEVERE |
trace lands on FINEST rather than FINE because Cobalt's trace level is per-instance, and a
graph of any size produces a lot of it. CobaltLogObserver also drops it by default; pass
minimumLevel: CobaltLogLevel.trace to let it through.