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
|
||||
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logging.getLogger('PIL.PngImagePlugin').setLevel(logging.WARNING)
|
||||
logging.basicConfig()
|
||||
|
||||
|
||||
# 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)
|
||||
|
||||
# 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.on_commit_queue = []
|
||||
self._cached_frozen_children = None
|
||||
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
import gevent.monkey
|
||||
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 gevent.pywsgi
|
||||
import gevent.wsgi
|
||||
|
|
|
@ -1,6 +1,12 @@
|
|||
# Use with
|
||||
# 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 os
|
||||
import sys
|
||||
|
|
Loading…
Reference in a new issue