summaryrefslogtreecommitdiffstats
path: root/src/osmo_gsm_tester/log.py
diff options
context:
space:
mode:
authorNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-05-06 23:58:46 +0200
committerNeels Hofmeyr <nhofmeyr@sysmocom.de>2017-05-08 10:12:25 +0000
commit1a2177cd1b84ff4e73f4e3c5775b8c46578831bb (patch)
tree462f2ea85ceb907016d84ea5c163f8e87b9fcd0d /src/osmo_gsm_tester/log.py
parentf81668827987441f99f2a17b0db54d92d81aa498 (diff)
log.py: LogTarget: return self for chaining modifiers
For example this allows tgt = LogTarget(foo).set_all_levels(bar).style_change(baz) Change-Id: If168cc06f644bde6183f3bc51e394c7705386b3e
Diffstat (limited to 'src/osmo_gsm_tester/log.py')
-rw-r--r--src/osmo_gsm_tester/log.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/osmo_gsm_tester/log.py b/src/osmo_gsm_tester/log.py
index 0e9b1f6..d3f2ea0 100644
--- a/src/osmo_gsm_tester/log.py
+++ b/src/osmo_gsm_tester/log.py
@@ -105,6 +105,7 @@ class LogTarget:
self.origin_fmt = '{:>%ds}' % self.origin_width
self.do_log_src = src
self.do_log_traceback = trace
+ return self
def style_change(self, time=None, time_fmt=None, category=None, level=None, origin=None, origin_width=None, src=None, trace=None):
'modify only the given aspects of the logging format'
@@ -118,13 +119,16 @@ class LogTarget:
src=(src if src is not None else self.do_log_src),
trace=(trace if trace is not None else self.do_log_traceback),
)
+ return self
def set_level(self, category, level):
'set global logging log.L_* level for a given log.C_* category'
self.category_levels[category] = level
+ return self
def set_all_levels(self, level):
self.all_levels = level
+ return self
def is_enabled(self, category, level):
if level == L_TRACEBACK: