mirror of
https://github.com/datafolklabs/cement.git
synced 2026-02-06 13:56:49 +00:00
Further Resolves Issue #211
This commit is contained in:
parent
a82a1762a8
commit
df139b157e
@ -26,7 +26,7 @@ development will happen here as 2.3.x under the git master branch.
|
||||
|
||||
Bugs:
|
||||
|
||||
* None
|
||||
* :issue:`211` - LoggingLogHandler namespace causes issues (regression)
|
||||
|
||||
Features:
|
||||
|
||||
|
||||
@ -121,10 +121,10 @@ class LoggingLogHandler(log.CementLogHandler):
|
||||
def _setup(self, app_obj):
|
||||
super(LoggingLogHandler, self)._setup(app_obj)
|
||||
if self._meta.namespace is None:
|
||||
self._meta.namespace = "%s:%s" % (self.app._meta.label,
|
||||
self._meta.namespace)
|
||||
self._meta.namespace = "%s" % self.app._meta.label
|
||||
|
||||
self.backend = logging.getLogger(self._meta.namespace)
|
||||
self.backend = logging.getLogger("cement:app:%s" % \
|
||||
self._meta.namespace)
|
||||
|
||||
# hack for application debugging
|
||||
if is_true(self.app._meta.debug):
|
||||
@ -168,9 +168,9 @@ class LoggingLogHandler(log.CementLogHandler):
|
||||
def clear_loggers(self, namespace):
|
||||
"""Clear any previously configured loggers for `namespace`."""
|
||||
|
||||
for i in logging.getLogger(namespace).handlers:
|
||||
logging.getLogger(namespace).removeHandler(i)
|
||||
self.backend = logging.getLogger(namespace)
|
||||
for i in logging.getLogger("cement:app:%s" % namespace).handlers:
|
||||
logging.getLogger("cement:app:%s" % namespace).removeHandler(i)
|
||||
self.backend = logging.getLogger("cement:app:%s" % namespace)
|
||||
|
||||
def _setup_console_log(self):
|
||||
"""Add a console log handler."""
|
||||
|
||||
@ -26,11 +26,11 @@ class TestApp(foundation.CementApp):
|
||||
|
||||
|
||||
class CementTestCase(unittest.TestCase):
|
||||
|
||||
"""
|
||||
A sub-class of unittest.TestCase.
|
||||
|
||||
"""
|
||||
|
||||
app_class = TestApp
|
||||
"""The test class that is used by self.make_app to create an app."""
|
||||
|
||||
|
||||
@ -46,7 +46,8 @@ class LoggingExtTestCase(test.CementExtTestCase):
|
||||
def test_bad_level(self):
|
||||
defaults = init_defaults()
|
||||
defaults['log'] = dict(
|
||||
level='BOGUS'
|
||||
level='BOGUS',
|
||||
to_console=False,
|
||||
)
|
||||
app = self.make_app(config_defaults=defaults)
|
||||
app.setup()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user