diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2006-01-25 16:48:06 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2006-01-25 16:48:06 +0000 |
commit | e3759d2a2e5fdb0e0a7f7dfa4f8244fdbb3ffe92 (patch) | |
tree | 31d523f4849b2a3232f92c2142cdd35b96beb5e1 /src/lib/Server/Statistics.py | |
parent | edca0b698637c3fd0a70af7e4752a46afca938d3 (diff) | |
download | bcfg2-e3759d2a2e5fdb0e0a7f7dfa4f8244fdbb3ffe92.tar.gz bcfg2-e3759d2a2e5fdb0e0a7f7dfa4f8244fdbb3ffe92.tar.bz2 bcfg2-e3759d2a2e5fdb0e0a7f7dfa4f8244fdbb3ffe92.zip |
Introduce the new logging infrastructure and convert the server (and bcfg2-info) over to using it
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@1717 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib/Server/Statistics.py')
-rw-r--r-- | src/lib/Server/Statistics.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/lib/Server/Statistics.py b/src/lib/Server/Statistics.py index 15f1586ef..4a86cdf35 100644 --- a/src/lib/Server/Statistics.py +++ b/src/lib/Server/Statistics.py @@ -2,9 +2,10 @@ __revision__ = '$Revision$' from lxml.etree import XML, SubElement, Element, XMLSyntaxError -from syslog import syslog, LOG_ERR from time import asctime, localtime, time +import logging + class Statistics(object): '''Manages the memory and file copy of statistics collected about client runs''' __min_write_delay__ = 30 @@ -15,6 +16,7 @@ class Statistics(object): self.dirty = 0 self.lastwrite = 0 self.ReadFromFile() + self.logger = logging.getLogger('Bcfg2.Server.Statistics') def pretty_print(self, element, level=0): '''Produce a pretty-printed text representation of element''' @@ -53,12 +55,11 @@ class Statistics(object): self.dirty = 0 #syslog(LOG_INFO, "Statistics: Read in statistics.xml") except (IOError, XMLSyntaxError): - syslog(LOG_ERR, "Statistics: Failed to parse %s"%(self.filename)) + self.logger.error("Failed to parse %s"%(self.filename)) self.element = Element('ConfigStatistics') self.WriteBack() self.dirty = 0 - def updateStats(self, xml, client): '''Updates the statistics of a current node with new data''' @@ -91,7 +92,7 @@ class Statistics(object): node.remove(elem) else: # Shouldn't be reached - syslog(LOG_ERR, "Statistics: Duplicate node entry for %s"%(client)) + self.logger.error("Duplicate node entry for %s"%(client)) # Set current time for stats newstat.set('time', asctime(localtime())) |