log method
Implementation
String? log(Level logLevel, Object? message,
{List<Object>? tags, LogFormat? customFormat}) {
if (_isLoggable(logLevel)) {
if (message is Function) {
message = message();
}
String msg;
if (message is String) {
msg = message;
} else {
msg = message.toString();
}
final LogRecord record = LogRecord(logLevel, msg, _stackFrame);
final LogFormat usableFormat =
customFormat ?? _globalFormat ?? _defaultFormat;
if (_tagsFilter == null ||
_tagsFilter?.isEmpty == true ||
tags
?.map((Object e) => _tagsFilter?.contains(e))
.where((bool? e) => e == true)
.isNotEmpty ==
true) {
final String log = usableFormat(record);
print(log);
_afterLogging?.call(record);
return log;
}
}
return null;
}