mirror of
https://github.com/joshuaboniface/rffmpeg.git
synced 2026-07-18 00:45:53 +00:00
Add file logging support
This commit is contained in:
parent
6751b41e6a
commit
487e18edf1
2 changed files with 23 additions and 0 deletions
15
rffmpeg.py
15
rffmpeg.py
|
|
@ -40,10 +40,23 @@ import os
|
|||
import sys
|
||||
import yaml
|
||||
import subprocess
|
||||
from datetime import datetime
|
||||
|
||||
def debug(msg):
|
||||
log_to_file = False
|
||||
logfile = ""
|
||||
try:
|
||||
log_to_file = config['log_to_file']
|
||||
logfile = config['logfile']
|
||||
except:
|
||||
pass
|
||||
|
||||
sys.stdout.write(str(msg) + '\n')
|
||||
|
||||
if log_to_file and logfile:
|
||||
with open(logfile, 'a') as logfhd:
|
||||
logfhd.write(str(datetime.now()) + ' ' + str(msg) + '\n')
|
||||
|
||||
###############################################################################
|
||||
# Configuration parsing
|
||||
###############################################################################
|
||||
|
|
@ -70,6 +83,8 @@ try:
|
|||
'state_tempdir': o_config['rffmpeg']['state']['tempdir'],
|
||||
'state_filename': o_config['rffmpeg']['state']['filename'],
|
||||
'state_contents': o_config['rffmpeg']['state']['contents'],
|
||||
'log_to_file': o_config['rffmpeg']['logging']['file'],
|
||||
'logfile': o_config['rffmpeg']['logging']['logfile'],
|
||||
'remote_hosts': o_config['rffmpeg']['remote']['hosts'],
|
||||
'remote_user': o_config['rffmpeg']['remote']['user'],
|
||||
'remote_args': o_config['rffmpeg']['remote']['args'],
|
||||
|
|
|
|||
|
|
@ -15,6 +15,14 @@ rffmpeg:
|
|||
# Contents of the state instance file
|
||||
contents: "{host}"
|
||||
|
||||
# Logging configuration
|
||||
logging:
|
||||
# Enable or disable file logging
|
||||
file: true
|
||||
|
||||
# Log messages to this file - ensure the user running rffmpeg can write to it
|
||||
logfile: "/var/log/jellyfin/rffmpeg.log"
|
||||
|
||||
# Remote (SSH) configuration
|
||||
remote:
|
||||
# A YAML list of remote hosts to connect to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue