diff options
| author | Steven Hiscocks <steven@hiscocks.me.uk> | 2013-02-15 17:09:47 +0000 |
|---|---|---|
| committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2015-07-05 14:19:15 -0400 |
| commit | 87531b51f5530583c916a645790208f5216e4089 (patch) | |
| tree | 93c46bbf113c781a22c1c0842faf9d25b7b522bc /systemd/journal.py | |
| parent | 108e4de1e41aa3b4b48654a9caab988fdb2d224f (diff) | |
| download | python-systemd-87531b51f5530583c916a645790208f5216e4089.tar.gz | |
systemd-python: Journal log_level moved to python
Diffstat (limited to 'systemd/journal.py')
| -rw-r--r-- | systemd/journal.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/systemd/journal.py b/systemd/journal.py index 8a688f9..40e40c3 100644 --- a/systemd/journal.py +++ b/systemd/journal.py @@ -115,6 +115,14 @@ class Journal(_Journal): return set(self._convert_field(key, value) for value in super(Journal, self).query_unique(key, *args, **kwargs)) + def log_level(self, level): + """Sets maximum log level by setting matches for PRIORITY.""" + if 0 <= level <= 7: + for i in range(level+1): + self.add_match(PRIORITY="%s" % i) + else: + raise ValueError("Log level must be 0 <= level <= 7") + def _make_line(field, value): if isinstance(value, bytes): return field.encode('utf-8') + b'=' + value |
