rewind 0.3.0 copy "rewind: ^0.3.0" to clipboard
rewind: ^0.3.0 copied to clipboard

A logging tool that enables you to record any data, with full customization of what is captured and the appearance of your logs at every logging level.

Rewind #

Pub Version Dart Package Docs License: MIT Build Status

rewind is a logging tool that enables you to record any data, with full customization of what is captured and the appearance of your logs at every logging level.

click here for an example output.

How To Use #

// log info
Log.i(object)
// log warning with additional message
Log.w(object, append: "Some more information.")
// log error overriding the string verion of the object
Log.e(object, override: "Use this instead.")

Levels #

See here for when to use each:

  • t: trace
  • d: debug
  • i: info
  • w: warning
  • e: error
  • f: fatal

How To Configure #

Log Level

Log.level = Level.trace;

Composing Log Level Configs

  // config for all not set
  Log.defaultLogConfig = LogLevelConfig.def(
    printer: SimplePrinter()
  );
  Log.warningLogConfig = LogLevelConfig.def(
    printer: PrettyPrinter()
  );
  Log.errorLogConfig = LogLevelConfig(
    printer: PrettyPrinter(),
    // the number of frames to keep if a stacktrace is present.
    framesToKeep: 10,
    // components to be a part of the log
    components: [
        ObjectTypeComponent(),
        StringifiedComponent(),
        AppendLogComponent(),
        IdComponent(),
        TimeComponent(),
        LogPointComponent(),
  ]);

You can create your own custom components by extends the LogComponent class.

Selecting The Output

By default the output goes to the console. But you can change it for example with:

Log.output = FileOutput(file: File("path/to/file"), overrideExisting: true, encoding: utf8);
Suported Outputs
  • Console
  • File
  • Memory
  • Stream
  • Multiple (combines any of the above)

Logging Guidelines #

Ever wonder what level to log at? Follow the flow chart below. Logging Guidelines

anyhow #

rewind is aware of types from the anyhow package. Therefore, when setting framesToKeep, rewind will adjust the stack trace display accordingly.

Example Ouput #

Multiple Components

Multiple Components

Single Component

Stringified Only Pretty

Single Component Simple Print

Stringified Only Simple

2
likes
150
pub points
22%
popularity

Publisher

verified publishervoyver.com

A logging tool that enables you to record any data, with full customization of what is captured and the appearance of your logs at every logging level.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

anyhow, rust_core, stack_trace, uuid

More

Packages that depend on rewind