mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
add file logging
This commit is contained in:
@@ -276,6 +276,7 @@ def process_file(f: str, dst: str = None):
|
||||
else:
|
||||
log.debug({ 'no body': f })
|
||||
|
||||
image.close()
|
||||
|
||||
def process_images(src: str, dst: str, args = None):
|
||||
params.src = src
|
||||
@@ -311,9 +312,3 @@ if __name__ == '__main__':
|
||||
for root, _sub_dirs, files in os.walk(loc):
|
||||
for f in files:
|
||||
process_file(os.path.join(root, f), dst)
|
||||
|
||||
"""
|
||||
- add interrogate on save
|
||||
- write final stats
|
||||
- create final grid
|
||||
"""
|
||||
|
||||
+11
-2
@@ -5,11 +5,20 @@ generic helper methods
|
||||
|
||||
import logging
|
||||
|
||||
|
||||
logging.basicConfig(level = logging.INFO, format = '%(asctime)s %(levelname)s: %(message)s')
|
||||
log_format = '%(asctime)s %(levelname)s: %(message)s'
|
||||
logging.basicConfig(level = logging.INFO, format = log_format)
|
||||
log = logging.getLogger("sd")
|
||||
|
||||
|
||||
def set_logfile(logfile):
|
||||
fh = logging.FileHandler(logfile)
|
||||
formatter = logging.Formatter(log_format)
|
||||
fh.setLevel(log.getEffectiveLevel())
|
||||
fh.setFormatter(formatter)
|
||||
log.addHandler(fh)
|
||||
log.info({ 'log file': logfile })
|
||||
|
||||
|
||||
class Map(dict):
|
||||
def __init__(self, *args, **kwargs):
|
||||
super(Map, self).__init__(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user