Skip to main content

cobalt_logging 1.5.0 copy "cobalt_logging: ^1.5.0" to clipboard
cobalt_logging: ^1.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.dev logging.

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.

0
likes
0
points
1.55k
downloads

Publisher

unverified uploader

Weekly Downloads

Cobalt adapter for package:logging — sends the DI graph's events to a dart.dev Logger.

Repository (GitHub)
View/report issues

Topics

#dependency-injection #di #logging #observability

License

unknown (license)

Dependencies

cobalt, logging

More

Packages that depend on cobalt_logging