This PR simplifies the user experience for getting basic messages logged to the console when calling SlideRule APIs.
Previously
Each SlideRule Python client module had it's own logger (except for a few which used the global logger)
The init function's verbose setting enabled/disabled the logging of messages received from the server
The init function's loglevel setting changed the logging level for the sliderule module's logger
It was on the user to create a log handler either manually or by using logging.basicConfig
This design gives the user full control - they can create individual handlers for the log messages generated in each of the submodules of the SlideRule Python client, and manage exactly how they are displayed. It also separates out the log messages coming from the server (which typically are a lot), from the log messages generated by the client (which typically are a few).
But in the vast majority of the cases, a user either wants to see messages printed to their screen, or they don't want to see anything. And the verbose option intuitively should control this.
Changes in this PR
The SlideRule Python client uses a single logger created in the core module
Server log messages are always logged at the level they are generated at
The init function's verbose setting will automatically create a console logger which will display all log messages of a sufficient log level to the screen
The init function's loglevel setting will always change the global log level, and when a console logger is created (i.e. when verbose is set to True), then it will change the console logger's log level as well.
If the user wants control over how the logger is created, they can always set verbose to False (which is the default), and create their own log handler and attach it to sliderule.logger
This PR simplifies the user experience for getting basic messages logged to the console when calling SlideRule APIs.
Previously
verbose
setting enabled/disabled the logging of messages received from the serverloglevel
setting changed the logging level for thesliderule
module's loggerlogging.basicConfig
This design gives the user full control - they can create individual handlers for the log messages generated in each of the submodules of the SlideRule Python client, and manage exactly how they are displayed. It also separates out the log messages coming from the server (which typically are a lot), from the log messages generated by the client (which typically are a few).
But in the vast majority of the cases, a user either wants to see messages printed to their screen, or they don't want to see anything. And the
verbose
option intuitively should control this.Changes in this PR
verbose
setting will automatically create a console logger which will display all log messages of a sufficient log level to the screenloglevel
setting will always change the global log level, and when a console logger is created (i.e. when verbose is set to True), then it will change the console logger's log level as well.verbose
to False (which is the default), and create their own log handler and attach it tosliderule.logger