How to see the output of Logger in dartlang (Dartium or command-line) How to see the output of Logger in dartlang (Dartium or command-line) dart dart

How to see the output of Logger in dartlang (Dartium or command-line)


In my Dart Bat-belt, I keep a function like this:

void printLogRecord(LogRecord r) {  print("${r.loggerName} ${r.level} ${r.message}");}

Then I'll add it to a Logger, typically the root logger:

Logger.root.level = Level.FINE;Logger.root.onRecord.listen(printLogRecord);


With the lastes m4 release this is the API that worked for me:

Logger.root.level = Level.FINEST;Logger.root.onRecord.listen((LogRecord r) {  window.console.log('${r.loggerName}(${r.level}): ${r.message}');});