Closed sc0rp10 closed 4 months ago
I dig into the code and found problematic string:
https://github.com/SourceHorizon/logger/blob/main/lib/src/filters/development_filter.dart#L12
var shouldLog = false;
assert(() {
if (event.level.value >= level!.value) {
shouldLog = true;
}
return true;
}());
Asserts have to be enabled to allow logger print logs. It's better to add this information to the readme at least, but IMO the logger shouldn't rely on asserts.
Hi, this is already noted in the README, as well as in the documentation of the default filter: https://github.com/SourceHorizon/logger?tab=readme-ov-file#logfilter
The
LogFilter
decides which log events should be shown and which don't.
The default implementation (DevelopmentFilter
) shows all logs withlevel >= Logger.level
while in debug mode (i.e., running dart with--enable-asserts
). In release mode all logs are omitted.
You are free to use the ProductionFilter
which doesn't rely on asserts (i.e. debug mode).
Hi! I try to create console application on Dart and logs is very important for this application, but, unfortunately, I can't see any log messages in the console even with very simple code from the example:
I created a new empty project
Then I added the Logger library:
I wrote dead simply script based on examples:
Finally I run the script:
But, unfortunately, I didn't see any logs in my console. I tried many different options - filters, outputs, levels but there is still no luck.
What can be wrong?