rewind

Creator: coderz1093

Last updated:

0 purchases

rewind Image
rewind Images
Add to Cart

Description:

rewind

Rewind #




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 #
// set log level
Log.level = Level.info;
// log info
Log.i(object);
// log info with additional message
Log.i(object, append: "Some more information.");
// log info overriding the string verion of the object
Log.i(object, override: "Use this instead.");
// log info with a stactrace related to the log object.
// Note: No need to ever do `StackTrace.current` since that is taken
// care of if you include the `LogPointComponent()` in your config
Log.i(object, stackTrace: stackTrace);
copied to clipboard
Since nothing will ever be logged unless Log.level is set, rewind is safe to use packages.
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;
copied to clipboard
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 stack trace is present.
framesToKeep: 10,
// components to be a part of the log
components: [
// Includes the Object runtime type
ObjectTypeComponent(),
// Stringifies the Object
StringifiedComponent(),
// Includes any appended messages
AppendLogComponent(),
// Creates a unique id for the log you can reference in the ui and/or intercept
IdComponent(),
// Captures the time at which the log occurred
TimeComponent(),
// Captures the stack trace at the point log was called
LogPointComponent(),
]);
copied to clipboard
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);
copied to clipboard
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.

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

Single Component

Single Component Simple Print

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.

Related Products

More From This Creator