-
Notifications
You must be signed in to change notification settings - Fork 29
Open
Labels
Description
Hello,
Sometimes there can be different needs depending on the type of log or its source, or we might need to ignore them. For such situations, it would be very beneficial to be able to modify the log request before it's processed through a callback like onBefore, or to be able to completely ignore the log request.
For example;
Logger.root.onRecord = (event) {
if (event.loggerName == 'xxx') {
return event.copyWith(message: newFormat(event.message)); // format event message
} else if (event.level == Level.WARNING) {
return null; // ignore this record/event
} else {
return event;
}
};