logger
logger copied to clipboard
It is not logging error and stack trace
Version 1.0.0
Usage: In development mode catching all flutter logs and printing them
onError: config.isProduction
? FirebaseCrashlytics.instance.recordError
: _reportCrash);
void _reportCrash(dynamic error, StackTrace stackTrace) {
getLogger('app_runner_reportCrash').e(error.toString(), [error, stackTrace]);
}
Problem: It is not printing the stack trace, just the message of error:
flutter: \^[[38;5;196m⛔ app_runner_reportCrash - ValueStream has no value. You should check ValueStream.hasValue before accessing ValueStream.value, or use ValueStream.valueOrNull instead.
<…>
Maybe is trimming the rest ??? I see <…> in output as text but would be great to have at least x top lines of stack trace.
I can modify the call to :
getLogger('app_runner_reportCrash').e(stackTrace.toString(), [error, stackTrace]);
Then I can see the stack trace but seems hacky, why is the library then accepting stack trace as second arg in the array ?
same issue. No stack trace printed though passed.
Did anyone find any solution for printing stack traces? I am using the below custom printer but the stack trace is printing null.
@override
List<String> log(LogEvent event) {
final color = PrettyPrinter.levelColors[event.level];
final emoji = PrettyPrinter.levelEmojis[event.level];
final message = event.message;
final stackTrace = event.stackTrace;
return [color!('$emoji $className: $message : $stackTrace')];
}
Output
