log method
void
log(
- String level,
- String message, {
- String? tag,
- dynamic ex,
- StackTrace? stacktrace,
inherited
Logs message
with level
and optional tag
, ex
(exception, stacktrace
Implementation
@override
void log(
String level,
String message, {
String? tag,
dynamic ex,
StackTrace? stacktrace,
}) {
final logTag = tag ?? LogTree.getTag();
final logLineBuilder = StringBuffer("$level\t$logTag:\t $message");
if (ex != null) {
logLineBuilder.write("\n$ex");
}
if (stacktrace != null) {
final tmpStacktrace = stacktrace.toString().split('\n');
final stackTraceMessage =
tmpStacktrace.map((stackLine) => "\t$stackLine").join("\n");
logLineBuilder.write("\n$stackTraceMessage");
}
printLog(logLineBuilder.toString(), level: level);
}