Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jérome Perrin
neoppod
Commits
188c55f9
Commit
188c55f9
authored
Nov 17, 2017
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
neolog: add support for xz-compressed logs, using external xzcat commands
parent
9ee4e04d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
neo/scripts/neolog.py
neo/scripts/neolog.py
+6
-3
No files found.
neo/scripts/neolog.py
View file @
188c55f9
...
@@ -22,7 +22,7 @@ from bisect import insort
...
@@ -22,7 +22,7 @@ from bisect import insort
from
logging
import
getLevelName
from
logging
import
getLevelName
from
zlib
import
decompress
from
zlib
import
decompress
comp_dict
=
dict
(
bz2
=
bz2
.
BZ2File
,
gz
=
gzip
.
GzipFile
)
comp_dict
=
dict
(
bz2
=
bz2
.
BZ2File
,
gz
=
gzip
.
GzipFile
,
xz
=
'xzcat'
)
class
Log
(
object
):
class
Log
(
object
):
...
@@ -46,9 +46,12 @@ class Log(object):
...
@@ -46,9 +46,12 @@ class Log(object):
os
.
stat
(
db_path
)
# do not create empty DB if file is missing
os
.
stat
(
db_path
)
# do not create empty DB if file is missing
self
.
_db
=
sqlite3
.
connect
(
db_path
)
self
.
_db
=
sqlite3
.
connect
(
db_path
)
else
:
else
:
import
shutil
,
tempfile
import
shutil
,
subprocess
,
tempfile
with
tempfile
.
NamedTemporaryFile
()
as
f
:
with
tempfile
.
NamedTemporaryFile
()
as
f
:
shutil
.
copyfileobj
(
ZipFile
(
db_path
),
f
)
if
type
(
ZipFile
)
is
str
:
subprocess
.
check_call
((
ZipFile
,
db_path
),
stdout
=
f
)
else
:
shutil
.
copyfileobj
(
ZipFile
(
db_path
),
f
)
self
.
_db
=
sqlite3
.
connect
(
f
.
name
)
self
.
_db
=
sqlite3
.
connect
(
f
.
name
)
name
=
name
.
rsplit
(
os
.
extsep
,
1
)[
0
]
name
=
name
.
rsplit
(
os
.
extsep
,
1
)[
0
]
self
.
_default_name
=
name
self
.
_default_name
=
name
...
...
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