monarch_utils 1.0.1 copy "monarch_utils: ^1.0.1" to clipboard
monarch_utils: ^1.0.1 copied to clipboard

outdated

Utilities for the monarch package. Mostly utilities for logging.

example/example.dart

import 'package:monarch_utils/log.dart';
import 'package:monarch_utils/log_config.dart';

final mainLogger = Logger('main');

void main() {
  // write log entries using `print` function, which prints to the console
  final subscription =
      writeLogEntryStream(print, printLoggerName: true, printTimestamp: true);

  sum(3, 5);
  sum(7, 11);

  final calculation = Calculation(13, 17);
  calculation.multipy();

  subscription.cancel();
}

int sum(int a, int b) {
  // log using a logger object
  final logger = Logger('sum');
  logger.fine('adding $a + $b');
  return a + b;
}

// you can also log using a mixin
class Calculation with Log {
  final int a;
  final int b;

  Calculation(this.a, this.b);

  int multipy() {
    log.info('multiplying $a * $b');
    return a * b;
  }
}
2
likes
0
pub points
49%
popularity

Publisher

verified publishermonarchapp.io

Utilities for the monarch package. Mostly utilities for logging.

Homepage
Repository (GitHub)
View/report issues

Documentation

Documentation

License

unknown (license)

More

Packages that depend on monarch_utils