handleLog method
Main log handler - override this single method for uniform handling of all log levels.
By default, log(), info(), error(), and fatal() delegate to this method.
Override only this method when your strategy handles all levels the same way.
For different behavior per level, override the individual methods instead.
Example:
class MyStrategy extends LogStrategy {
@override
Future<void> handleLog(LogEntry entry) async {
if (!shouldLog(event: entry.event)) return;
final context = entry.mergedContext;
await sendToMyService(entry.message, context);
}
}
Implementation
Future<void> handleLog(LogEntry entry) async {
// Default: no-op. Override this in your strategy.
}