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
e57b1bdd
Commit
e57b1bdd
authored
Nov 12, 2015
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neolog: new --node option to filter logs produced by threaded tests
parent
259539e5
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
3 deletions
+12
-3
neo/scripts/neolog.py
neo/scripts/neolog.py
+12
-3
No files found.
neo/scripts/neolog.py
View file @
e57b1bdd
...
@@ -29,10 +29,11 @@ class Log(object):
...
@@ -29,10 +29,11 @@ class Log(object):
_protocol_date
=
None
_protocol_date
=
None
def
__init__
(
self
,
db_path
,
decode_all
=
False
,
date_format
=
None
,
def
__init__
(
self
,
db_path
,
decode_all
=
False
,
date_format
=
None
,
filter_from
=
None
):
filter_from
=
None
,
node_list
=
None
):
self
.
_date_format
=
'%F %T'
if
date_format
is
None
else
date_format
self
.
_date_format
=
'%F %T'
if
date_format
is
None
else
date_format
self
.
_decode_all
=
decode_all
self
.
_decode_all
=
decode_all
self
.
_filter_from
=
filter_from
self
.
_filter_from
=
filter_from
self
.
_node_list
=
node_list
name
=
os
.
path
.
basename
(
db_path
)
name
=
os
.
path
.
basename
(
db_path
)
try
:
try
:
name
,
ext
=
name
.
rsplit
(
os
.
extsep
,
1
)
name
,
ext
=
name
.
rsplit
(
os
.
extsep
,
1
)
...
@@ -99,12 +100,16 @@ class Log(object):
...
@@ -99,12 +100,16 @@ class Log(object):
self
.
_next_protocol
=
float
(
'inf'
)
self
.
_next_protocol
=
float
(
'inf'
)
def
_emit
(
self
,
date
,
name
,
levelname
,
msg_list
):
def
_emit
(
self
,
date
,
name
,
levelname
,
msg_list
):
if
not
name
:
name
=
self
.
_default_name
if
self
.
_node_list
and
name
not
in
self
.
_node_list
:
return
prefix
=
self
.
_date_format
prefix
=
self
.
_date_format
if
prefix
:
if
prefix
:
d
=
int
(
date
)
d
=
int
(
date
)
prefix
=
'%s.%04u '
%
(
time
.
strftime
(
prefix
,
time
.
localtime
(
d
)),
prefix
=
'%s.%04u '
%
(
time
.
strftime
(
prefix
,
time
.
localtime
(
d
)),
int
((
date
-
d
)
*
10000
))
int
((
date
-
d
)
*
10000
))
prefix
+=
'%-9s %-10s '
%
(
levelname
,
name
or
self
.
_default_name
)
prefix
+=
'%-9s %-10s '
%
(
levelname
,
name
)
for
msg
in
msg_list
:
for
msg
in
msg_list
:
print
prefix
+
msg
print
prefix
+
msg
...
@@ -195,6 +200,9 @@ def main():
...
@@ -195,6 +200,9 @@ def main():
parser
.
add_option
(
'-F'
,
'--flush'
,
action
=
"append"
,
type
=
"int"
,
parser
.
add_option
(
'-F'
,
'--flush'
,
action
=
"append"
,
type
=
"int"
,
help
=
'with -f, tell process PID to flush logs approximately N'
help
=
'with -f, tell process PID to flush logs approximately N'
' seconds (see -s)'
,
metavar
=
'PID'
)
' 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)'
)
parser
.
add_option
(
'-s'
,
'--sleep-interval'
,
type
=
"float"
,
default
=
1
,
parser
.
add_option
(
'-s'
,
'--sleep-interval'
,
type
=
"float"
,
default
=
1
,
help
=
'with -f, sleep for approximately N seconds (default 1.0)'
help
=
'with -f, sleep for approximately N seconds (default 1.0)'
' between iterations'
,
metavar
=
'N'
)
' between iterations'
,
metavar
=
'N'
)
...
@@ -209,7 +217,8 @@ def main():
...
@@ -209,7 +217,8 @@ def main():
filter_from
=
options
.
filter_from
filter_from
=
options
.
filter_from
if
filter_from
and
filter_from
<
0
:
if
filter_from
and
filter_from
<
0
:
filter_from
+=
time
.
time
()
filter_from
+=
time
.
time
()
log_list
=
[
Log
(
db_path
,
options
.
all
,
options
.
date
,
filter_from
)
log_list
=
[
Log
(
db_path
,
options
.
all
,
options
.
date
,
filter_from
,
options
.
node
)
for
db_path
in
args
]
for
db_path
in
args
]
if
options
.
follow
:
if
options
.
follow
:
try
:
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