journal

Last updated:

0 purchases

journal Image
journal Images
Add to Cart

Description:

journal

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');
copied to clipboard
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.');
}
copied to clipboard
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.



Default output in Windows Terminal




Default output in Mozilla Firefox




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,
),
];
copied to clipboard
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),
);
});
copied to clipboard
Release history #
See the changelog for a detailed list of changes throughout the package's history.

License:

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.