hemend_async_log_recorder 0.3.1 copy "hemend_async_log_recorder: ^0.3.1" to clipboard
hemend_async_log_recorder: ^0.3.1 copied to clipboard

An Extension to the hemend_logger package that enables asynchronously logging

example/main.dart

import 'package:hemend_async_log_recorder/hemend_async_log_recorder.dart';
import 'package:hemend_logger/hemend_logger.dart';

void main() async {
  Logger.root.level = Level.ALL;
  final logger = Logger.root;
  HemendLogger.defaultLogger()
    ..addListener(
      HemendAsyncLogRecorder.post(postUrl: 'https://<Server>/record'),
    )
    ..addListener(
      HemendAsyncLogRecorder.file(filePath: 'example/test.log'),
    );
  for (var i = 0; i < 10; i++) {
    logger.info(
      i,
    );
  }
  // sends this body to the server
  //{
  //  "ticket_id": 555,
  //  "updated_at": 1679201760431,
  //  "payload": {
  //    "test": "test"
  //  }
  //}
  //
  // and append
  // 2023-5-23 15:59:43 [Root-Logger] <Info>: test
  // to test.log file
}
1
likes
160
pub points
21%
popularity

Publisher

verified publisherhemend.com

An Extension to the hemend_logger package that enables asynchronously logging

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

go_flow, hemend_logger, http, meta, pool

More

Packages that depend on hemend_async_log_recorder