mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 09:23:56 +00:00
Merge branch 'develop' of github.com:saltstack/salt into issues/2087
This commit is contained in:
commit
9c72fac67e
@ -61,6 +61,7 @@ class TestsLoggingHandler(object):
|
|||||||
self.level = level
|
self.level = level
|
||||||
self.format = format
|
self.format = format
|
||||||
self.activated = False
|
self.activated = False
|
||||||
|
self.prev_logging_level = None
|
||||||
|
|
||||||
def activate(self):
|
def activate(self):
|
||||||
class Handler(logging.Handler):
|
class Handler(logging.Handler):
|
||||||
@ -76,11 +77,20 @@ class TestsLoggingHandler(object):
|
|||||||
self.handler.setFormatter(formatter)
|
self.handler.setFormatter(formatter)
|
||||||
logging.root.addHandler(self.handler)
|
logging.root.addHandler(self.handler)
|
||||||
self.activated = True
|
self.activated = True
|
||||||
|
# Make sure we're running with the lowest logging level with our
|
||||||
|
# tests logging handler
|
||||||
|
current_logging_level = logging.root.getEffectiveLevel()
|
||||||
|
if current_logging_level > logging.DEBUG:
|
||||||
|
self.prev_logging_level = current_logging_level
|
||||||
|
logging.root.setLevel(0)
|
||||||
|
|
||||||
def deactivate(self):
|
def deactivate(self):
|
||||||
if not self.activated:
|
if not self.activated:
|
||||||
return
|
return
|
||||||
logging.root.removeHandler(self.handler)
|
logging.root.removeHandler(self.handler)
|
||||||
|
# Restore previous logging level if changed
|
||||||
|
if self.prev_logging_level is not None:
|
||||||
|
logging.root.setLevel(self.prev_logging_level)
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def messages(self):
|
def messages(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user