Remove Elixir library
Update SQLAlchemy
This commit is contained in:
+10
-8
@@ -1,5 +1,5 @@
|
||||
# sqlalchemy/log.py
|
||||
# Copyright (C) 2006-2011 the SQLAlchemy authors and contributors <see AUTHORS file>
|
||||
# Copyright (C) 2006-2014 the SQLAlchemy authors and contributors <see AUTHORS file>
|
||||
# Includes alterations by Vinay Sajip vinay_sajip@yahoo.co.uk
|
||||
#
|
||||
# This module is part of SQLAlchemy and is released under
|
||||
@@ -19,7 +19,6 @@ instance only.
|
||||
|
||||
import logging
|
||||
import sys
|
||||
from sqlalchemy import util
|
||||
|
||||
# set initial level to WARN. This so that
|
||||
# log statements don't occur in the absense of explicit
|
||||
@@ -28,24 +27,24 @@ rootlogger = logging.getLogger('sqlalchemy')
|
||||
if rootlogger.level == logging.NOTSET:
|
||||
rootlogger.setLevel(logging.WARN)
|
||||
|
||||
|
||||
def _add_default_handler(logger):
|
||||
handler = logging.StreamHandler(sys.stdout)
|
||||
handler.setFormatter(logging.Formatter(
|
||||
'%(asctime)s %(levelname)s %(name)s %(message)s'))
|
||||
logger.addHandler(handler)
|
||||
|
||||
|
||||
_logged_classes = set()
|
||||
def class_logger(cls, enable=False):
|
||||
|
||||
|
||||
def class_logger(cls):
|
||||
logger = logging.getLogger(cls.__module__ + "." + cls.__name__)
|
||||
if enable == 'debug':
|
||||
logger.setLevel(logging.DEBUG)
|
||||
elif enable == 'info':
|
||||
logger.setLevel(logging.INFO)
|
||||
cls._should_log_debug = lambda self: logger.isEnabledFor(logging.DEBUG)
|
||||
cls._should_log_info = lambda self: logger.isEnabledFor(logging.INFO)
|
||||
cls.logger = logger
|
||||
_logged_classes.add(cls)
|
||||
|
||||
return cls
|
||||
|
||||
class Identified(object):
|
||||
logging_name = None
|
||||
@@ -56,6 +55,7 @@ class Identified(object):
|
||||
def _should_log_info(self):
|
||||
return self.logger.isEnabledFor(logging.INFO)
|
||||
|
||||
|
||||
class InstanceLogger(object):
|
||||
"""A logger adapter (wrapper) for :class:`.Identified` subclasses.
|
||||
|
||||
@@ -167,6 +167,7 @@ class InstanceLogger(object):
|
||||
level = self.logger.getEffectiveLevel()
|
||||
return level
|
||||
|
||||
|
||||
def instance_logger(instance, echoflag=None):
|
||||
"""create a logger for an instance that implements :class:`.Identified`."""
|
||||
|
||||
@@ -191,6 +192,7 @@ def instance_logger(instance, echoflag=None):
|
||||
|
||||
instance.logger = logger
|
||||
|
||||
|
||||
class echo_property(object):
|
||||
__doc__ = """\
|
||||
When ``True``, enable log output for this element.
|
||||
|
||||
Reference in New Issue
Block a user