-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement common logging mechanism for all modules. #124
Labels
Milestone
Comments
titom73
added
type: enhancement
New feature or request
state: accepted
Issue is part of the development roadmap
labels
Jan 28, 2020
Merged
titom73
added a commit
that referenced
this issue
Mar 4, 2020
First test to build logging across all modules. Goal: ----- - centralize file destination for both modules & module_utils * - common and easy mechanism to log in modules: no if constraint to make it easy to read. Based on logging library Workflow: --------- - Create a new module_utils.logger file to configure logger - Get a logger in modules with MODULE_LOGGER = logging.getLogger('arista.cvp.cv_facts') - use MODULE_LOGER.<level> to log in file Options & configuration: ------------------------ - Log Facility is set to info by default and can be override with an env var: ANSIBLE_CVP_LOG_LEVEL - Log destination is a file set to /temp/arista.cvp.debug.log and can be override with an env var: ANSIBLE_CVP_LOG_FILE Log output examples: -------------------- ``` 03-04 11:35 arista.cvp.cv_facts INFO Start cv_facts module execution 03-04 11:35 arista.cvp.cv_facts INFO Connecting to CVP 03-04 11:35 urllib3.connectionpool DEBUG Starting new HTTPS connection (1): 10.83.28.164:443 ```
titom73
added a commit
that referenced
this issue
Mar 4, 2020
Configure default handler to run log rotation by default to avoid to saturate disk storage.
titom73
added a commit
that referenced
this issue
Mar 4, 2020
Even if no logging is active in modules, default configuration has been set: ``` import ansible_collections.arista.cvp.plugins.module_utils.logger MODULE_LOGGER = logging.getLogger('arista.cvp.cv_facts') MODULE_LOGGER.info('Start cv_facts module execution') [...] MODULE_LOGGER.debug('*** Connected to CVP') ```
titom73
added
status: in-progress
Currently under investigation or implementation
and removed
state: accepted
Issue is part of the development roadmap
labels
Mar 4, 2020
titom73
added a commit
that referenced
this issue
Mar 4, 2020
titom73
added a commit
that referenced
this issue
Mar 5, 2020
Because URLLIB3 is logging a lot, being able to specificy urllib3 specifically is implemented: - Log facilyt is set to WARNING by default for urllib3 handler - User can get other verbosity with env variable: `export ANSIBLE_CVP_LOG_APICALL=debug` Output is part of collection log file.
Tracked in PR #146 |
titom73
removed
the
status: in-progress
Currently under investigation or implementation
label
Mar 5, 2020
titom73
added a commit
that referenced
this issue
Mar 7, 2020
Even if no logging is active in modules, default configuration has been set: ``` import ansible_collections.arista.cvp.plugins.module_utils.logger MODULE_LOGGER = logging.getLogger('arista.cvp.cv_facts') MODULE_LOGGER.info('Start cv_facts module execution') [...] MODULE_LOGGER.debug('*** Connected to CVP') ```
titom73
added a commit
that referenced
this issue
Mar 7, 2020
Configure a dedicated logging.handler to log cv_client and cv_api fucntions: ``` arista.cvp.cv_client: DEBUG - func: get_inventory (L:105) - get_inventory: called arista.cvp.cv_client: DEBUG - func: get_inventory (L:106) - 2019 Inventory API Call ```
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Implement a generic logging / debug support in all modules to make debug easier.
Some pointers provided by @networkop during previous review:
log
exampleThe text was updated successfully, but these errors were encountered: