log method
void
log(
- LogLevel level,
- Object? referer,
- String message, [
- dynamic error,
- StackTrace? stackTrace,
override
publish a log message
Implementation
@override
void log(level, referer, message, [error, stackTrace]) {
if (level.index < minLevel.index) return;
final msg = [
level.name.toString().toUpperCase().add(":").padRight(10),
(referer?.runtimeType.toString().add(":") ?? "").padRight(18),
_multiLinePadded(_limited(message, maxWidth - 31), 29),
if (error != null)
_multiLinePadded(
"\n" + _ansiU("ERROR:") + " " + _multiLinePadded("$error", 8), 29),
if (stackTrace != null)
level.index >= traceMinLevel.index
? "\n".padRight(11) + _multiLinePadded(stackTrace.toString(), 11)
: "\n".padRight(29) + _ansiU("TRACE:") + " [suppressed]"
].join("");
// ignore: avoid_print
print(level.ansify(msg));
}