Closed benthillerkus closed 7 months ago
using setLogger
instead of setSendLogsToDart
is because it is the matching native code for the setLogger
call.
When you ctrl-f the code base for setLogger
, you'll see all the code you need to see.
this pr looks much nicer.
case "setOptions":
and case "setLogLevel":
in the same order. I'm very used to this order and dont want it to change. maybe in some other PR.FlutterBluePlus.setLogLevel(kDebugMode ? LogLevel.verbose : LogLevel.none);
do not do this. Logs should always be on in the example app. It's important people file issues on github with logssetLogger
in the example app. This hurts perf. It's not recommended to use it. The example app should show best practices._logger
should be renamed _log
setLogHandler
Just as a design philosophy, FBP uses very few abstractions. If you want to see why, look at flutter_reactive_ble, where everything is abstracted. FBP took the opposite approach.
i.e.
void _log(...) {
if (_logger == null) {
print(...)
} else {
_logger(...)
}
}
e..g
Optionally handle all FBP logs yourself. i.e. send them to disk, another logging framework, etc.
// Note: setting a custom logger can impact perf
// due to increased platform channel usage
FlutterBluePlus.setLogger((message) {
// your custom log handling code
});
closing. It should be a minimal implementation with minimal changes.
I was gonna impl those changes, but I couldn't really find the time for it in the last 2 weeks
no worries. If you get around to it, feel free to do it!
I do like the idea of the PR.
By habit, I close PRs & Issues that are not "active" for awhile, as people often drop off.
I added this in 1.34.5
FlutterBluePlus.logs
This is just #830 but squashed & rebased to
master
and with most of the provided feedback addressed. I didn't renamesetSendLogsToDart
tosetLogger
yet though, because even if my name was pretty clunky it was at least accurate to what's happening.