This commit is contained in:
Milka64 2021-01-30 21:28:34 +01:00
parent 705ba32565
commit 7ab8aa21b9
2 changed files with 7 additions and 6 deletions

View file

@ -1,5 +1,6 @@
[DEFAULT]
logs = /var/log/kabot/kabot.log
audio_path = /tmp/
voice_channel = channel_name
text_channel = channel_name

View file

@ -35,12 +35,6 @@ logger.setLevel(logging.INFO)
## format du log
formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(message)s')
## definition du fichier de log (chemin, level, etc ...)
file_handler = RotatingFileHandler('/var/log/kabot/kabot.log', 'a', 1000000, 1)
file_handler.setLevel(logging.INFO)
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
## definition de l'affichage des logs dans la console
stream_handler = logging.StreamHandler()
stream_handler.setLevel(logging.INFO)
@ -563,6 +557,12 @@ def main():
)
args = parser.parse_args()
config = configparser.ConfigParser()
log_file = config['DEFAULT']['logs']
## definition du fichier de log (chemin, level, etc ...)
file_handler = RotatingFileHandler(log_file, 'a', 1000000, 1)
file_handler.setLevel(logging.INFO)
file_handler.setFormatter(formatter)
logger.addHandler(file_handler)
if not os.path.exists(args.config):
logger.critical('config file not found')
exit(1)