Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
Fixed ntpq debug command to not open a logfile on its own.
· cf7b248a
Ian Bruene
authored
Jun 19, 2017
cf7b248a
Added logfile command to ntpq. Same function as -l option.
· 8f62ba00
Ian Bruene
authored
Jun 19, 2017
8f62ba00
Hide whitespace changes
Inline
Side-by-side
ntpclients/ntpq
View file @
8f62ba00
...
...
@@ -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
...
...