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:
parent
1aff62bc42
commit
b5b6227fee
@ -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',
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -47,3 +47,6 @@ out_path = /mnt/multimedia/NEW/
|
||||
|
||||
# fixed input path
|
||||
in_path =
|
||||
|
||||
# log file
|
||||
log_file = /var/log/photo-importer-server.log
|
||||
|
11
server.py
11
server.py
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user