1
0
mirror of https://github.com/sashacmc/photo-importer.git synced 2024-11-24 08:02:14 +02:00

log_file config option added

This commit is contained in:
sashacmc 2019-11-27 18:41:32 +01:00
parent 1aff62bc42
commit b5b6227fee
3 changed files with 12 additions and 3 deletions

View File

@ -32,6 +32,7 @@ class Config(object):
'remote_drive_reg': 'sd[d-z][0-9]',
'out_path': '/mnt/multimedia/NEW/',
'in_path': '',
'log_file': '/var/log/photo-importer-server.log',
}
}

View File

@ -47,3 +47,6 @@ out_path = /mnt/multimedia/NEW/
# fixed input path
in_path =
# log file
log_file = /var/log/photo-importer-server.log

View File

@ -126,7 +126,7 @@ class PhotoImporterHandler(http.server.BaseHTTPRequestHandler):
try:
dev = params['d'][0]
except:
except Exception:
dev = ''
result = None
@ -334,7 +334,7 @@ class PhotoImporterServer(http.server.HTTPServer):
def args_parse():
parser = argparse.ArgumentParser()
parser.add_argument('-c', '--config', help='Config file')
parser.add_argument('-l', '--logfile', help='Log file', default='slog.txt')
parser.add_argument('-l', '--logfile', help='Log file')
return parser.parse_args()
@ -343,7 +343,12 @@ def main():
cfg = config.Config(args.config)
log.initLogger(args.logfile)
if args.logfile:
logfile = args.logfile
else:
logfile = cfg['server']['log_file']
log.initLogger(logfile)
try:
server = PhotoImporterServer(cfg)