Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Debian Kernel (http://www.linux-archive.org/debian-kernel/)
-   -   logging: Loggers live a cosmopolitan life, forget about them after created. (http://www.linux-archive.org/debian-kernel/327603-logging-loggers-live-cosmopolitan-life-forget-about-them-after-created.html)

Ales Kozumplik 02-17-2010 03:53 PM

logging: Loggers live a cosmopolitan life, forget about them after created.
 
---
anaconda_log.py | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/anaconda_log.py b/anaconda_log.py
index 83a70c7..edaf232 100644
--- a/anaconda_log.py
+++ b/anaconda_log.py
@@ -32,6 +32,7 @@ import types
DEFAULT_TTY_LEVEL = logging.INFO
ENTRY_FORMAT = "%(asctime)s,%(msecs)03d %(levelname)s %(name)s: %(message)s"
TTY_FORMAT = "%(levelname)s %(name)s: %(message)s"
+STDOUT_FORMAT = "%(asctime)s %(message)s"
DATE_FORMAT = "%H:%M:%S"

MAIN_LOG_FILE = "/tmp/anaconda.log"
@@ -70,11 +71,11 @@ class AnacondaLog:
self.tty_loglevel = DEFAULT_TTY_LEVEL
self.remote_syslog = None
# Create the base of the logger hierarcy.
- self.logger = logging.getLogger("anaconda")
- self.logger.setLevel(logging.DEBUG)
- self.addFileHandler(MAIN_LOG_FILE, self.logger,
+ logger = logging.getLogger("anaconda")
+ logger.setLevel(logging.DEBUG)
+ self.addFileHandler(MAIN_LOG_FILE, logger,
minLevel=logging.DEBUG)
- self.forwardToSyslog(self.logger)
+ self.forwardToSyslog(logger)

# External program output log
program_logger = logging.getLogger("program")
@@ -87,12 +88,11 @@ class AnacondaLog:
# stdout. Anything written here will also get passed up to the
# parent loggers for processing and possibly be written to the
# log.
- self.stdoutLogger = logging.getLogger("anaconda.stdout")
- self.stdoutLogger.setLevel(logging.INFO)
-
+ stdoutLogger = logging.getLogger("anaconda.stdout")
+ stdoutLogger.setLevel(logging.INFO)
# Add a handler for the duped stuff. No fancy formatting, thanks.
- self.addFileHandler (sys.stdout, self.stdoutLogger,
- fmtStr="%(asctime)s %(message)s", minLevel=logging.INFO)
+ self.addFileHandler(sys.stdout, stdoutLogger,
+ fmtStr=STDOUT_FORMAT, minLevel=logging.INFO)

# Add a simple handler - file or stream, depending on what we're given.
def addFileHandler (self, file, addToLogger, minLevel=DEFAULT_TTY_LEVEL,
--
1.6.6

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list


All times are GMT. The time now is 10:30 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.