Logging Events

If you want to add custom logging to existing plugins, or custom plugins then follow the instructions below.
Logging can make it easier to debug code, keep track of bot events in the server, etc.
You can optionally disable logging in your config.ini file.

Logging Features

Logging Steps

  1. Open the python script you wish to add logging to.
  2. Add this line to the top of the file: 'from JJMumbleBot.lib.utils.logging_utils import log'
    Importing the logging_utils file will allow you to use the logger that is used for the entire bot.
  3. To log an event you can use: 'log(log_level, log_message, origin=log_origin)'
    Example Usage:
                    log(INFO, "I logged an info event!", origin=L_GENERAL)
    output: [JJMumbleBot(3.0.4).General]: I logged an info event! log(WARNING, "I logged a warning event!", origin=L_LOGGING)
    output: [JJMumbleBot(3.0.4).Logging]: I logged a warning event! log(CRITICAL, "I logged a critical issue!", origin=L_ALIASES)
    output: [JJMumbleBot(3.0.4).Aliases]: I logged a critical event!

By default, logs are time rotated every day at midnight.
The bot will store a maximum of 20 logs (20 days worth) before recycling the oldest logs.

Example Saved Log:

image