.SH SYNOPSIS
\fBzypper-log\fP [\fIoptions\fP] [\fIpid\fP]
.SH DESCRIPTION
-zypper-log can read zypper's logfiles. It can also handle rotated logfiles, and will open plain, gz and bz2-compressed files.
+zypper-log can read zypper's logfiles. It can also handle rotated logfiles, and will open plain, xz, gz and bz2-compressed files.
.sp
By default zypper.log will be read in.
.sp
# Author: Dominik Heidler <dheidler@suse.de>
import os, string, re, bz2, zlib, sys, time, argparse, errno
+import subprocess
filenamelen = 0
pidlen = 0
print >> sys.stderr, "\rIOError: %s: '%s'" % (e.strerror, e.filename)
sys.exit(1)
fext = logfile.split('.')[-1]
- if fext == 'bz2':
+ if fext == 'xz':
+ logtxt = subprocess.Popen(['xzcat',logfile], stdout=subprocess.PIPE).stdout.read()
+ elif fext == 'bz2':
logtxt = bz2.decompress(logtxt)
elif fext == 'gz':
logtxt = zlib.decompress(logtxt)