Closed stsdc closed 2 years ago
@stsdc I am not sure what action you want me to take as a result of this information? Can you give me a little more background so I can know how to move forward with this.
Thanks.
Please consider that as hint to coloring log levels. When I tried to use coloredlogs
, there was one line that was colored properly and also it's duplicate that was in a default color. I ended up disabling coloring because of that :/
Would be cool to see color logs, since they are more readable. I think this issue is connected with allowing to set a user log level. Thanks :relieved:
I am reluctant to add the dependency so that everyone using Bluezero has to install coloredlogs
. Bluezero is a library rather than an end application so I prefer it to have as few dependencies as possible. I know coloredlogs
is only one dependency but then that has other dependencies... and so it goes on :-(
However, that shouldn't stop you being about to use coloredlogs
. The reason the logging doesn't work as expected is often that the wrong name has been passed to getLogger()
. Each Bluezero file has its own logger. E.g. localGATT
.
Let me know if you have an example that doesn't work and I can review.
I am reluctant to add the dependency so that everyone using Bluezero has to install coloredlogs. Bluezero is a library rather than an end application so I prefer it to have as few dependencies as possible. I know coloredlogs is only one dependency but then that has other dependencies... and so it goes on :-(
^ this totally understandable
Basically added these lines to https://github.com/synergia/synermycha-ble-simulator/blob/bluezero/main.py
import coloredlogs
coloredlogs.install(level='DEBUG')
The problem with your example above is you don't seem to have set the output for the bluezero.localGATT
to use coloredlogs
. I think you need:
logger = logging.getLogger('bluezero.localGATT')
coloredlogs.install(level='DEBUG', logger=logger)
I have done an experiment with the eddystone_scanner.py example in Bluezero. I've added some logging to the example and output from the observer
Which gives the following output
This seems to be working as expected. Let me know if this works for you also and I'll close the issue.
You're 100% right. Thank You for Your help and time!
In private projects I'm using something like this.