[Git][NTPsec/ntpsec][master] 2 commits: Fixed ntpq debug command to not open a logfile on its own.
Ian Bruene
gitlab at mg.gitlab.com
Mon Jun 19 21:34:15 UTC 2017
Ian Bruene pushed to branch master at NTPsec / ntpsec
Commits:
cf7b248a by Ian Bruene at 2017-06-19T15:49:31-05:00
Fixed ntpq debug command to not open a logfile on its own.
- - - - -
8f62ba00 by Ian Bruene at 2017-06-19T16:25:51-05:00
Added logfile command to ntpq. Same function as -l option.
- - - - -
1 changed file:
- ntpclients/ntpq
Changes:
=====================================
ntpclients/ntpq
=====================================
--- a/ntpclients/ntpq
+++ b/ntpclients/ntpq
@@ -667,10 +667,25 @@ usage: hostnames [yes|no]
except ValueError:
print("What?")
self.session.debug = self.debug
- if self.debug > 0:
- self.session.logfp = open("ntpq.log", "a", 1) # 1 => line buffered
print("debug level is %d" % self.debug)
+ def do_logfile(self, line):
+ "view/change logfile. \"<stderr>\" will log to stderr instead of a file"
+ if not line:
+ print(repr(self.logfp.name))
+ return
+ if self.logfp != sys.stderr:
+ self.logfp.close()
+ if line == "<stderr>":
+ self.logfp = self.session.logfp = sys.stderr
+ else:
+ try:
+ logfp = open(line, "a", 1) # 1 => line buffered
+ self.logfp = self.session.logfp = logfp
+ print("Logfile set to", line)
+ except:
+ print("Could not open", line, "for logging.")
+
def help_debug(self):
self.say("""\
function: set/change debugging level
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/a58eb322c08bf92d1e15edefb50a14fc1b41dcb7...8f62ba00eafaf44cd9b232459106fa26e0f84f38
---
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/a58eb322c08bf92d1e15edefb50a14fc1b41dcb7...8f62ba00eafaf44cd9b232459106fa26e0f84f38
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/20170619/bfb8a5a0/attachment.html>
More information about the vc
mailing list