Improve log creation and use custom formatter.
This commit is contained in:
parent
be35f3bb1f
commit
f052858d5f
3 changed files with 15 additions and 3 deletions
|
@ -23,8 +23,7 @@ from voussoirkit import pathclass
|
||||||
from voussoirkit import spinal
|
from voussoirkit import spinal
|
||||||
|
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig()
|
||||||
logging.getLogger('PIL.PngImagePlugin').setLevel(logging.WARNING)
|
|
||||||
|
|
||||||
|
|
||||||
# Note: Setting user_version pragma in init sequence is safe because it only
|
# Note: Setting user_version pragma in init sequence is safe because it only
|
||||||
|
@ -1160,8 +1159,9 @@ class PhotoDB(PDBAlbumMixin, PDBBookmarkMixin, PDBPhotoMixin, PDBTagMixin, PDBUs
|
||||||
os.makedirs(self.thumbnail_directory.absolute_path, exist_ok=True)
|
os.makedirs(self.thumbnail_directory.absolute_path, exist_ok=True)
|
||||||
|
|
||||||
# OTHER
|
# OTHER
|
||||||
self.log = logging.getLogger(__name__)
|
self.log = logging.getLogger('etiquette:%s' % self.data_directory.absolute_path)
|
||||||
self.log.setLevel(self.config['log_level'])
|
self.log.setLevel(self.config['log_level'])
|
||||||
|
|
||||||
self.on_commit_queue = []
|
self.on_commit_queue = []
|
||||||
self._cached_frozen_children = None
|
self._cached_frozen_children = None
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
import gevent.monkey
|
import gevent.monkey
|
||||||
gevent.monkey.patch_all()
|
gevent.monkey.patch_all()
|
||||||
|
|
||||||
|
import logging
|
||||||
|
handler = logging.StreamHandler()
|
||||||
|
log_format = '{levelname}:etiquette.{module}.{funcName}: {message}'
|
||||||
|
handler.setFormatter(logging.Formatter(log_format, style='{'))
|
||||||
|
logging.getLogger().addHandler(handler)
|
||||||
|
|
||||||
import etiquette_flask
|
import etiquette_flask
|
||||||
import gevent.pywsgi
|
import gevent.pywsgi
|
||||||
import gevent.wsgi
|
import gevent.wsgi
|
||||||
|
|
|
@ -1,6 +1,12 @@
|
||||||
# Use with
|
# Use with
|
||||||
# py -i etiquette_easy.py
|
# py -i etiquette_easy.py
|
||||||
|
|
||||||
|
import logging
|
||||||
|
handler = logging.StreamHandler()
|
||||||
|
log_format = '{levelname}:etiquette.{module}.{funcName}: {message}'
|
||||||
|
handler.setFormatter(logging.Formatter(log_format, style='{'))
|
||||||
|
logging.getLogger().addHandler(handler)
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
Loading…
Reference in a new issue