Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
3600e59c
Commit
3600e59c
authored
May 22, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neolog: new option to hide the node column
parent
f6eb02b4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
4 deletions
+13
-4
neo/scripts/neolog.py
neo/scripts/neolog.py
+13
-4
No files found.
neo/scripts/neolog.py
View file @
3600e59c
...
...
@@ -29,10 +29,11 @@ class Log(object):
_protocol_date
=
None
def
__init__
(
self
,
db_path
,
decode_all
=
False
,
date_format
=
None
,
filter_from
=
Non
e
,
node_list
=
None
):
filter_from
=
None
,
node_column
=
Tru
e
,
node_list
=
None
):
self
.
_date_format
=
'%F %T'
if
date_format
is
None
else
date_format
self
.
_decode_all
=
decode_all
self
.
_filter_from
=
filter_from
self
.
_node_column
=
node_column
self
.
_node_list
=
node_list
name
=
os
.
path
.
basename
(
db_path
)
try
:
...
...
@@ -109,7 +110,8 @@ class Log(object):
d
=
int
(
date
)
prefix
=
'%s.%04u '
%
(
time
.
strftime
(
prefix
,
time
.
localtime
(
d
)),
int
((
date
-
d
)
*
10000
))
prefix
+=
'%-9s %-10s '
%
(
levelname
,
name
)
prefix
+=
(
'%-9s %-10s '
%
(
levelname
,
name
)
if
self
.
_node_column
else
'%-9s '
%
levelname
)
for
msg
in
msg_list
:
print
prefix
+
msg
...
...
@@ -189,7 +191,8 @@ def main():
' seconds (see -s)'
,
metavar
=
'PID'
)
parser
.
add_option
(
'-n'
,
'--node'
,
action
=
"append"
,
help
=
'only show log entries from the given node'
' (only useful for logs produced by threaded tests)'
)
' (only useful for logs produced by threaded tests),'
" special value '-' hides the column"
)
parser
.
add_option
(
'-s'
,
'--sleep-interval'
,
type
=
"float"
,
default
=
1
,
help
=
'with -f, sleep for approximately N seconds (default 1.0)'
' between iterations'
,
metavar
=
'N'
)
...
...
@@ -204,8 +207,14 @@ def main():
filter_from
=
options
.
filter_from
if
filter_from
and
filter_from
<
0
:
filter_from
+=
time
.
time
()
node_list
=
options
.
node
or
[]
try
:
node_list
.
remove
(
'-'
)
node_column
=
False
except
ValueError
:
node_column
=
True
log_list
=
[
Log
(
db_path
,
options
.
all
,
options
.
date
,
filter_from
,
options
.
node
)
node_column
,
node_list
)
for
db_path
in
args
]
if
options
.
follow
:
try
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment