fix: minor bugs

This commit is contained in:
problematicconsumer
2023-09-18 14:01:44 +03:30
parent 2cd5a9fd0a
commit 921636a091
10 changed files with 157 additions and 21 deletions

View File

@@ -3,15 +3,24 @@ import 'dart:io';
import 'package:loggy/loggy.dart';
class MultiLogPrinter extends LoggyPrinter {
MultiLogPrinter(this.consolePrinter, this.filePrinter);
MultiLogPrinter(
this.consolePrinter,
this.otherPrinters,
);
final LoggyPrinter consolePrinter;
final LoggyPrinter? filePrinter;
List<LoggyPrinter> otherPrinters;
void addPrinter(LoggyPrinter printer) {
otherPrinters.add(printer);
}
@override
void onLog(LogRecord record) {
consolePrinter.onLog(record);
filePrinter?.onLog(record);
for (final printer in otherPrinters) {
printer.onLog(record);
}
}
}