[Git][NTPsec/ntpsec][master] Fixed severe oversite in dolog() and tests
Ian Bruene
gitlab at mg.gitlab.com
Wed Aug 9 04:01:50 UTC 2017
Ian Bruene pushed to branch master at NTPsec / ntpsec
Commits:
8c85ab7a by Ian Bruene at 2017-08-08T22:44:39-05:00
Fixed severe oversite in dolog() and tests
- - - - -
2 changed files:
- pylib/util.py
- tests/pylib/test_util.py
Changes:
=====================================
pylib/util.py
=====================================
--- a/pylib/util.py
+++ b/pylib/util.py
@@ -57,10 +57,10 @@ MS_VARS = ("rootdelay", "rootdisp", "offset", "sys_jitter", "clk_jitter",
PPM_VARS = ("frequency", "clk_wander", "clk_wander_threshold")
-def dolog(logfp, text, level):
+def dolog(logfp, text, debug, threshold):
if logfp is None:
return # can turn off logging by supplying a None file descriptior
- if debug >= level:
+ if debug >= threshold:
logfp.write(text)
logfp.flush() # we don't want to lose an important log to a crash
=====================================
tests/pylib/test_util.py
=====================================
--- a/tests/pylib/test_util.py
+++ b/tests/pylib/test_util.py
@@ -27,11 +27,11 @@ class TestPylibUtilMethods(unittest.TestCase):
# uh... if someone can think of a way to do that please tell me
# Test with logging on, below threshold
jig = LogTester()
- f(jig, "blah", 0)
+ f(jig, "blah", 0, 3)
self.assertEqual((jig.written, jig.flushed), (None, False))
# Test with logging on, above threshold
jig.__init__() # reset
- f(jig, "blah", 0)
+ f(jig, "blah", 4, 3)
self.assertEqual((jig.written, jig.flushed), ("blah", True))
def test_rfc3339(self):
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/8c85ab7ab45e50ef9ddd3121d95c5e59bd269eaa
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/commit/8c85ab7ab45e50ef9ddd3121d95c5e59bd269eaa
You're receiving this email because of your account on gitlab.com.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170809/7343a96c/attachment.html>
More information about the vc
mailing list