mirror of
https://github.com/virt-manager/virt-manager.git
synced 2025-02-25 18:55:27 -06:00
virt-manager.py: Fix setup_logging to be a bit more general
This commit is contained in:
parent
9fcf63b559
commit
0445be92c2
@ -133,14 +133,14 @@ def drop_stdio():
|
||||
os.dup2(0, 1)
|
||||
os.dup2(0, 2)
|
||||
|
||||
def setup_logging(debug_stdout):
|
||||
def setup_logging(appname, debug_stdout):
|
||||
# Configure python logging to capture all logs we generate
|
||||
# to $HOME/.virt-manager/virt-manager.log This file has
|
||||
# to $HOME/.virt-manager/${app}.log This file has
|
||||
# proved invaluable for debugging
|
||||
MAX_LOGSIZE = 1024 * 1024 # 1MB
|
||||
ROTATE_NUM = 5
|
||||
DIR_NAME = ".virt-manager"
|
||||
FILE_NAME = "virt-manager.log"
|
||||
FILE_NAME = "%s.log" % appname
|
||||
FILE_MODE = 'ae'
|
||||
FILE_FORMAT = ("[%(asctime)s virt-manager %(process)d] "
|
||||
"%(levelname)s (%(module)s:%(lineno)d) %(message)s")
|
||||
@ -173,9 +173,7 @@ def setup_logging(debug_stdout):
|
||||
"%(asctime)s (%(module)s:%(lineno)d): %(message)s"))
|
||||
rootLogger.addHandler(streamHandler)
|
||||
|
||||
global logging_setup
|
||||
logging_setup = True
|
||||
logging.info("Application startup")
|
||||
logging.info("%s startup" % appname)
|
||||
|
||||
# Register libvirt handler
|
||||
def libvirt_callback(ctx_ignore, err):
|
||||
@ -363,7 +361,10 @@ def main():
|
||||
raise RuntimeError(_("Unable to initialize GTK: %s") % gtk_error)
|
||||
raise gtk_error
|
||||
|
||||
setup_logging(options.debug)
|
||||
setup_logging(appname, options.debug)
|
||||
global logging_setup
|
||||
logging_setup = True
|
||||
|
||||
logging.debug("Launched as: %s" % origargs)
|
||||
logging.debug("GTK version: %s" % str(gtk.gtk_version))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user