expose backup_count to config

This commit is contained in:
Jonathan Baecker 2020-05-12 13:13:17 +02:00
parent 1f9f20f9e5
commit 0b8be6e931
3 changed files with 10 additions and 5 deletions

View File

@ -38,12 +38,14 @@ leave recipient blank, if you don't need this.
```YAML
logging:
log_to_file: True
backup_count: 7
log_path: "/var/log/ffplayout/"
log_level: "DEBUG"
ffmpeg_level: "ERROR"
```
Logging to file, if `log_to_file = False` > log to console.
`backup_count` says how long log files will be saved in days.
Path to **/var/log/** only if you run this program as *deamon*.
`log_level` can be: **DEBUG, INFO, WARNING, ERROR**
`ffmpeg_level` can be: **INFO, WARNING, ERROR**

View File

@ -21,10 +21,12 @@ mail:
mail_level: "ERROR"
logging:
helptext: Logging to file, if 'log_to_file' False log to console. Path to /var/log/
only if you run this program as deamon. 'log_level' can be DEBUG, INFO, WARNING,
helptext: Logging to file, if 'log_to_file' False log to console. 'backup_count'
says how long log files will be saved in days. Path to /var/log/ only if you
run this program as deamon. 'log_level' can be DEBUG, INFO, WARNING,
ERROR. 'ffmpeg_level' can be INFO, WARNING, ERROR.
log_to_file: True
backup_count: 7
log_path: "/var/log/ffplayout/"
log_level: "DEBUG"
ffmpeg_level: "ERROR"

View File

@ -203,6 +203,7 @@ def load_config():
if _init.load:
_log.to_file = cfg['logging']['log_to_file']
_log.backup_count = cfg['logging']['backup_count']
_log.path = cfg['logging']['log_path']
_log.level = cfg['logging']['log_level']
_log.ff_level = cfg['logging']['ffmpeg_level']
@ -306,11 +307,11 @@ if _log.to_file and _log.path != 'none':
p_format = logging.Formatter('[%(asctime)s] [%(levelname)s] %(message)s')
f_format = logging.Formatter('[%(asctime)s] %(message)s')
p_file_handler = TimedRotatingFileHandler(playout_log, when='midnight',
backupCount=5)
backupCount=_log.backup_count)
d_file_handler = TimedRotatingFileHandler(decoder_log, when='midnight',
backupCount=5)
backupCount=_log.backup_count)
e_file_handler = TimedRotatingFileHandler(encoder_log, when='midnight',
backupCount=5)
backupCount=_log.backup_count)
p_file_handler.setFormatter(p_format)
d_file_handler.setFormatter(f_format)