* log important events
This commit is contained in:
+5
-1
@@ -16,6 +16,7 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import syslog
|
||||
from os.path import exists
|
||||
import bsddb3.db as db
|
||||
|
||||
@@ -65,6 +66,7 @@ def init(database = True, write = True,
|
||||
else:
|
||||
ctx.ui = ui
|
||||
|
||||
syslog.openlog('pisi') # initialize log
|
||||
|
||||
# If given define stdout and stderr. Needed by buildfarm currently
|
||||
# but others can benefit from this too.
|
||||
@@ -73,7 +75,6 @@ def init(database = True, write = True,
|
||||
if stderr:
|
||||
ctx.stderr = stderr
|
||||
|
||||
|
||||
import pisi.config
|
||||
ctx.config = pisi.config.Config(options)
|
||||
|
||||
@@ -103,6 +104,9 @@ def init(database = True, write = True,
|
||||
|
||||
def finalize():
|
||||
if ctx.initialized:
|
||||
|
||||
syslog.closelog()
|
||||
|
||||
pisi.repodb.finalize()
|
||||
pisi.installdb.finalize()
|
||||
if ctx.filesdb != None:
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#
|
||||
|
||||
import sys
|
||||
import syslog
|
||||
import locale
|
||||
|
||||
import gettext
|
||||
@@ -66,6 +67,7 @@ class CLI(UI):
|
||||
def info(self, msg, verbose = False, noln = False):
|
||||
# TODO: need to look at more kinds of info messages
|
||||
# let's cheat from KDE :)
|
||||
#syslog.syslog(syslog.LOG_INFO, msg)
|
||||
if noln:
|
||||
msgend = ''
|
||||
else:
|
||||
@@ -74,6 +76,7 @@ class CLI(UI):
|
||||
|
||||
def warning(self, msg, verbose = False):
|
||||
msg = unicode(msg)
|
||||
syslog.syslog(syslog.LOG_WARNING, msg)
|
||||
if ctx.get_option('no_color'):
|
||||
self.output(_('Warning: ') + msg + '\n', err=True, verbose=verbose)
|
||||
else:
|
||||
@@ -81,6 +84,7 @@ class CLI(UI):
|
||||
|
||||
def error(self, msg):
|
||||
msg = unicode(msg)
|
||||
syslog.syslog(syslog.LOG_ERROR, msg)
|
||||
if ctx.get_option('no_color'):
|
||||
self.output(_('Error: ') + msg + '\n', err=True)
|
||||
else:
|
||||
@@ -89,6 +93,7 @@ class CLI(UI):
|
||||
def action(self, msg, verbose = False):
|
||||
#TODO: this seems quite redundant?
|
||||
msg = unicode(msg)
|
||||
syslog.syslog(syslog.LOG_INFO, msg)
|
||||
self.output(colorize(msg + '\n', 'green'))
|
||||
|
||||
def choose(self, msg, opts):
|
||||
@@ -147,3 +152,4 @@ class CLI(UI):
|
||||
msg = None
|
||||
if msg:
|
||||
self.output(colorize(msg + '\n', 'cyan'))
|
||||
syslog.syslog(syslog.LOG_NOTICE, msg)
|
||||
|
||||
Reference in New Issue
Block a user