fix #53
This commit is contained in:
parent
705ba32565
commit
7ab8aa21b9
2 changed files with 7 additions and 6 deletions
|
@ -1,5 +1,6 @@
|
||||||
[DEFAULT]
|
[DEFAULT]
|
||||||
|
|
||||||
|
logs = /var/log/kabot/kabot.log
|
||||||
audio_path = /tmp/
|
audio_path = /tmp/
|
||||||
voice_channel = channel_name
|
voice_channel = channel_name
|
||||||
text_channel = channel_name
|
text_channel = channel_name
|
||||||
|
|
|
@ -35,12 +35,6 @@ logger.setLevel(logging.INFO)
|
||||||
## format du log
|
## format du log
|
||||||
formatter = logging.Formatter('%(asctime)s :: %(levelname)s :: %(message)s')
|
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
|
## definition de l'affichage des logs dans la console
|
||||||
stream_handler = logging.StreamHandler()
|
stream_handler = logging.StreamHandler()
|
||||||
stream_handler.setLevel(logging.INFO)
|
stream_handler.setLevel(logging.INFO)
|
||||||
|
@ -563,6 +557,12 @@ def main():
|
||||||
)
|
)
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
config = configparser.ConfigParser()
|
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):
|
if not os.path.exists(args.config):
|
||||||
logger.critical('config file not found')
|
logger.critical('config file not found')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
Loading…
Reference in a new issue