/usr/share/pyshared/quodlibet/util/logging.py is in exfalso 3.0.2-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | import os
import quodlibet.util
from quodlibet.const import LOGDIR
LOGS = {}
MAX_LOG_SIZE = 1000
GENERAL = _("General")
def log(string, log=None):
if isinstance(string, unicode):
string = string.encode("utf-8", "replace")
log = log or GENERAL
LOGS.setdefault(log, []).append(string)
while len(LOGS[log]) > MAX_LOG_SIZE:
LOGS[log].pop(0)
def names():
names = sorted(LOGS.keys())
if GENERAL in names:
names.remove(GENERAL)
names.insert(0, GENERAL)
return names
def contents(name):
return LOGS.get(name, [_("No log available.")])
def dump(path=LOGDIR):
try:
quodlibet.util.mkdir(path)
for name in LOGS.keys():
filename = os.path.join(path, name + ".log")
fileobj = file(filename, "w")
fileobj.write("\n".join(LOGS[name]) + "\n")
fileobj.close()
except (IOError, OSError):
print_w("Unable to dump logs.")
|