journal 0.1.0 copy "journal: ^0.1.0" to clipboard
journal: ^0.1.0 copied to clipboard

A simple log writer and subscriber usable both from libraries and applications.

Journal #

A simple log writer and subscriber usable both from libraries and applications.

Example #

To create a journal, simply instantiate Journal with a unique name, normally the name of the package that emits the entries.

import 'package:journal/journal.dart';

const journal = Journal('http_server');

Following that, you can simply log entries.

journal.info('Started HTTP server.', values: {'port': port.toJournal});

if (address.isUnbound) {
  journal.warn('Be careful when not binding the server to a concrete address.');
}

Default output #

The default output uses a pretty-printed format on all supported platforms.

Note that you might need to set Journal.forceFormatTerminalOutput to get properly formatted output in your terminal.

[assets/terminal.png]
Default output in Windows Terminal

[assets/web-firefox.png]
Default output in Mozilla Firefox

[assets/web-chrome.png]
Default output in Google Chrome

Configuration #

To configure journal, you can either implement your own JournalOutput or override the parameters of the default one.

Journal.outputs = const [
  DefaultJournalOutput(
    displayTimestamp: true,
    displayLevel: true,
    displayZone: false,
    displayName: true,
    displayTrace: true,
  ),
];

Compatibility #

For compatibility with the logging package, simply direct its records to journal.

import 'package:logging/logging.dart'

Logger.root.onRecord.listen((record) {
  Journal.record(
    record.loggerName,
    JournalEntry.fromLogging(record),
  );
});

Release history #

See the changelog for a detailed list of changes throughout the package's history.

3
likes
0
points
55
downloads

Publisher

verified publisherskreborn.me

Weekly Downloads

A simple log writer and subscriber usable both from libraries and applications.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

js, logging, meta, source_map_stack_trace, source_maps, stack_trace

More

Packages that depend on journal