A Python content management system designed for kirsle.net featuring a blog, comments and photo albums. https://rophako.kirsle.net/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
773 B

# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, absolute_import
"""Debug and logging functions."""
import logging
from rophako.settings import Config
class LogHandler(logging.Handler):
"""A custom logging handler."""
def emit(self, record):
# The initial log line, which has the $prefix$ in it.
line = self.format(record)
line = line.replace('$prefix$', '')
# Set up the logger.
logger = logging.getLogger("rophako")
handler = LogHandler()
handler.setFormatter(logging.Formatter("[%(asctime)s] [%(levelname)s] $prefix$%(message)s"))
# Log level.
if Config.site.debug == "true":