rlog 0.0.2 copy "rlog: ^0.0.2" to clipboard
rlog: ^0.0.2 copied to clipboard

An easy-to-use logging library with some presets, like Rotation, Console, Multi.

An easy-to-use logging library with some presets.

Features #

  • Create a logger that log messages in your style.
  • Preset loggers/encoders/writers.
  • Rotation logger.

Getting started #

Add to pubspec.yaml.

dependencies:
  rlog: <version>

Usage #

/// Console logger
final logger = Logger.console();

logger.debug('some texts');
logger.error('some texts');
/// Rotation logger
final logger = Logger.build(
  encoder: ConsoleEncoder(),
  writer: RotationWriter(
    join(Directory.current.path, 'test-rotation.log'),
    maxCount: 16,
    maxSize: 1 << 12,
  ),
);

for (var i = 0; i < 1000; i++) {
  logger.info('test '.padRight(1 << 6, 'test '));
}
/// MultiWriter logger
final logger = Logger.build(
  encoder: ConsoleEncoder(),
  writer: MultiWriter([
    ConsoleWriter(),
    FileWriter(
      join(Directory.current.path, 'test-multi.log'),
    ),
  ]),
);

for (var i = 0; i < 10; i++) {
  await Future.delayed(Duration(milliseconds: 20));
  logger.info('test test');
}
2
likes
160
points
33
downloads

Publisher

verified publisherronbb.fun

Weekly Downloads

An easy-to-use logging library with some presets, like Rotation, Console, Multi.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

path

More

Packages that depend on rlog