simpleLoggerHandler function

void simpleLoggerHandler(
  1. LogRecord record
)

A simple implementation of Logger handler. You can use it to configure your root logger, such as

new Logger("myorg").onRecord.listen(simpleLoggerHandler);

Implementation

void simpleLoggerHandler(LogRecord record) {
  //for better response time, do it async (since the onRecord stream is sync)
  Future(() {
    print("${record.time}:${record.loggerName}:${record.sequenceNumber}\n"
      "${record.level}: ${record.message}");
    if (record.error != null)
      print("Cause: ${record.error}");
    if (record.stackTrace != null)
      print("${record.stackTrace}");
  });
}