Logging in database
This module adds a logs handler writing to database.
- Following code will create a log in db with a unique pid per logger:
- import logging logger = SmileLogger(dbname, model_name, res_id, uid) logger.info(your_message)
- Create logs when executing an action.
- Archive and delete old logs from database.
- Give users access right to see logs.
Table of contents
- Developer adds import logging to his python file.
- Developer must add following code to his action and specify the database, the model name, the res_id, and uid. Then give a message to log for information:
logger = SmileLogger(dbname, model_name, res_id, uid) logger.info(your_message)
- Administrator must create a Scheduled Action to call the function archive_and_delete_old_logs, configure archiving path and the number of days to archive and delete logs.
To add Logs handler to an action :
Import SmileDBLogger to your python code and add code lines as shown in following example :
Add smile_log to your module dependence:
Now execute the action.:
Go to Settings > Technical > Logging> Logs menu to see logs.
Administrator can give access right to users, to see logs, by checking Smile Logs / User.
- To create the scheduled action:
Go to Settings > Technical > Automation > Scheduled Actions and fill fields as follow:
(Make sure that the given folder has a write access!)
After running the action, the extracted logs file in csv format is as shown in next figure:
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us smashing it by providing a detailed and welcomed feedback here.
Do not contact contributors directly about support or help with technical issues.
This addons does not collect any data and does not set any browser cookies.
Please log in to comment on this module
- The author can leave a single reply to each comment.
- This section is meant to ask simple questions or leave a rating. Every report of a problem experienced while using the module should be addressed to the author directly (refer to the following point).
- If you want to start a discussion with the author, please use the developer contact information. They can usually be found in the description.