Reputation: 191
When I add the following code to my dart programme I expect to have some logging in observatory but instead it is empty.
void setupLogging() {
Logger.root.level = Level.ALL;
Logger.root.onRecord.listen((LogRecord rec) {
print('${rec.level.name}: ${rec.time}: ${rec.message}');
});
}
And then in some method:
log.fine('Databases are up and running');
Upvotes: 1
Views: 70
Reputation: 13560
Simply using print
doesn't work, but the dart:developer
library contains a log
function that you can use for that purpose.
It has the same arguments as used by the LogRecord
from the logging
package:
void log(String message,
{DateTime time,
int sequenceNumber,
int level: 0,
String name: '',
Zone zone,
Object error,
StackTrace stackTrace});
Upvotes: 1