notice 1.0.0-alpha.5 copy "notice: ^1.0.0-alpha.5" to clipboard
notice: ^1.0.0-alpha.5 copied to clipboard

Another logger with a focus on simplicity and cross-package logging.

Notice (not a warning, but this packages name) #

Another logger with a focus on simplicity and cross-package logging.

Simplest example #

final notice = Notice(
  outputs: [ConsoleOutput()],
);
notice.info("Hello World");
// prints: 2023-12-11T20:00:28.495978 INFO: Hello World

Creating sub-loggers #

Always know where the message came from using breadcrumbs

final notice = Notice(
  outputs: [ConsoleOutput()],
  breadcrumb: "main"
);
final subNotice = Notice.childOf(notice, breadcrumb: "foo");
subNotice.info("Sub Logger message");
// prints: 2023-12-11T20:03:28.048468 main.foo INFO: Sub Logger message

Filtering messages #

If you need multiple filters you can also use CombinedFilter

final notice = Notice(outputs: [
  FilteredOutput(
    LevelFilter(NoticeLevel.info),
    ConsoleOutput(),
  ),
]);
notice.info("Will be logged");
notice.warn("Will also be logged");
notice.trace("Will not be logged");
// prints:
// 2023-12-11T20:18:26.721386 INFO: Will be logged
// 2023-12-11T20:18:26.723331 WARN: Will also be logged

Third-Party-Package logging #

final notice = Notice(
  outputs: [ConsoleOutput()],
  registries: [globalNoticeRegistry],
);
final thirdPartyPackageNotice = Notice(
  parent: globalNoticeRegistry,
  breadcrumb: "BarPackage",
);
thirdPartyPackageNotice.error("Error from another package");
// prints: 2023-12-11T20:09:51.188054 BarPackage ERROR: Error from another package

Extensible #

Create your own implementation of filters and outputs to extend the behaviour of this package

Roadmap #

  • Sentry support
    in fact, sentry support already exists but i have to change this project to a mono-repo structure first, before moving the output implementation here
  • Improve output formatting
    Add colors and possibly borders to the output. This will also include a formatting interface for better code seperation and customizability.
  • Adapters to most of the common dart loggers
    To improve the experience when switching to notice and not make package authors clients dependent on it
10
likes
0
points
250
downloads

Publisher

unverified uploader

Weekly Downloads

Another logger with a focus on simplicity and cross-package logging.

Repository (GitLab)
View/report issues

License

unknown (license)

Dependencies

fast_immutable_collections, meta

More

Packages that depend on notice