Commit ad379295 authored by Julien Muchembled's avatar Julien Muchembled

neolog: add support for zstd-compressed logs

parent 4a96c8b6
...@@ -23,7 +23,17 @@ from itertools import chain ...@@ -23,7 +23,17 @@ from itertools import chain
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, xz='xzcat') try:
import zstd
except ImportError:
zstdcat = 'zstdcat'
else:
from cStringIO import StringIO
def zstdcat(path):
with open(path, 'rb') as f:
return StringIO(zstd.decompress(f.read()))
comp_dict = dict(bz2=bz2.BZ2File, gz=gzip.GzipFile, xz='xzcat', zst=zstdcat)
class Log(object): class Log(object):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment