You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some caracara modules do not carry the "caracara" name in their logging scope. This causes logging.getLogger('caracara').setLevel(logging.WARNING) to only affect some parts of caracara.
2023-04-12 09:24:16,742 CustomIoaApiModule Initialising API module: CustomIoaApiModule
2023-04-12 09:24:16,742 FlightControlApiModule Initialising API module: FlightControlApiModule
2023-04-12 09:24:16,742 FlightControlApiModule Configuring the FalconPy Flight Control API
2023-04-12 09:24:16,743 HostsApiModule Initialising API module: HostsApiModule
2023-04-12 09:24:16,743 HostsApiModule Configuring the FalconPy Hosts API
2023-04-12 09:24:16,743 HostsApiModule Configuring the FalconPy Host Group API
2023-04-12 09:24:16,743 PreventionPoliciesApiModule Initialising API module: PreventionPoliciesApiModule
2023-04-12 09:24:16,745 PreventionPoliciesApiModule Configuring the FalconPy Prevention Policies API
2023-04-12 09:24:16,745 ResponsePoliciesApiModule Initialising API module: ResponsePoliciesApiModule
2023-04-12 09:24:16,745 ResponsePoliciesApiModule Configuring the FalconPy Response Policies API
2023-04-12 09:24:16,746 RTRApiModule Initialising API module: RTRApiModule
To Reproduce
Run some code like the following, that just silences the 'caracara' module to a specified level :
# Silence a little bit all this debug noise enabled by defaultforcaracara_logging_scopein (
'caracara',
#'CustomIoaApiModule',#'FlightControlApiModule',#'HostsApiModule',#'PreventionPoliciesApiModule',#'RTRApiModule',#'ResponsePoliciesApiModule',
):
ifself.debug:
passelse:
l=logging.getLogger(caracara_logging_scope)
l.setLevel(logging.WARNING)
It's not much, and we have a workaround ready with the list of modules generating logs added to a hardcoded list. That being said, I have a vague feeling that some PEP might suggest prefixing logging scopes.
Expected behavior
All code loaded by caracara receives the same log level
Suggested fixes
Prefix these logging scopes with caracara or caracara.modules. What we do in our code base is just pick the current module and call it a day. Prior to that we even added the class name, but having one class per file makes it simpler. ( I won't comment on my spaghetti code base file lengths :D )
@jshcodes I think this is a very reasonable bug report, and one I'd like to get sorted. I wanted to tag you here to check whether this was something we'd done out of spec in any other Python libraries we offer, such as FalconPy?
Describe the bug
Some caracara modules do not carry the "caracara" name in their logging scope. This causes
logging.getLogger('caracara').setLevel(logging.WARNING)
to only affect some parts of caracara.To Reproduce
Run some code like the following, that just silences the 'caracara' module to a specified level :
It's not much, and we have a workaround ready with the list of modules generating logs added to a hardcoded list. That being said, I have a vague feeling that some PEP might suggest prefixing logging scopes.
Expected behavior
All code loaded by caracara receives the same log level
Suggested fixes
Prefix these logging scopes with
caracara
orcaracara.modules
. What we do in our code base is just pick the current module and call it a day. Prior to that we even added the class name, but having one class per file makes it simpler. ( I won't comment on my spaghetti code base file lengths :D )Environment
Operating System Version
Debian bookworm
Python Version
Python 3.10.5
Poetry Version
Poetry (version 1.4.1)
Python Package Versions
The text was updated successfully, but these errors were encountered: