Closed milindgoel15 closed 1 year ago
Hi, I figured that you didn't configure a custom printer and are therefore using the default printer (PrettyPrinter
) for the logger.
PrettyPrinter
has by default a methodCount
of 2
, which means that every log, even non errors, is accommodated by a stack trace.
You can disable that feature by providing your own printer instance with a methodCount
of 0
:
var logger = Logger(
printer: PrettyPrinter(methodCount: 0),
);
Oh, thats why.
Also, can we disable the rectangle border as well? (The lines around the log messages)
Sure, just set noBoxingByDefault: true
.
Hi,
I wanted to log a message based on the result of the work manager job in my app. So on success run, it shows ran successfully or error in case of failure run. So I checked in the case of success run and this is what i got in the logs:
console logs
```console I/flutter (10449): │ #0 callbackDispatcher.it throw some exception of some kind?
This is my work manager code with logger:
code
```dart Workmanager().executeTask((task, inputData) async { switch (task) { case "currentWeather": final sharedPreference = await SharedPreferences.getInstance(); try { final weatherResponse = await WidgetService() .getWidgetWeather(sharedPreference.getString('activeKey') ?? ""); WidgetService().updateWidget(weatherResponse); logger.i("Scheduled job ran successfully!"); } catch (e) { logger.e( 'Error occurred while fetching weather:', error: e, ); } return Future.value(true); } return Future.value(true); }); ```