printLog<E> method
void
printLog<E>(
- Level level,
- dynamic message, {
- String? tag,
- StackTrace? stackTrace,
- E? exception,
- dynamic errorMarkedMessage,
override
Implementation
@override
void printLog<E>(Level level, dynamic message,
{String? tag, StackTrace? stackTrace, E? exception, dynamic errorMarkedMessage}) {
try {
assert(message != null);
if (errorMarkedMessage != null && errorMarkedMessage is StackTrace) {
return;
}
if (parameter?.logFilter == null) {
parameter?.setLogFilter(LogFilter());
}
var logEvent = new LogEvent(level, message,
tag: tag ?? "",
stackTrace: stackTrace,
exception: exception,
dateTime: DateTime.now(),
errorMarkedMessage: errorMarkedMessage);
//过滤掉不需要打印日志
if (!(parameter?.logFilter?.filterLog(logEvent) ?? false)) {
return;
}
parameter?.logListener?.onLogListener(Future.value(logEvent));
if (parameter?.isPrintLog ?? false) {
var nested = logPrinter?.log(logEvent);
if (nested != null) {
queue.addFirst(nested);
if (!isPrinting) {
_performLog();
}
}
}
} catch (e) {
print(e);
}
}