bumping version to 0.29-1
[certmaster.git] / certmaster / logger.py
old mode 100755 (executable)
new mode 100644 (file)
index e679f3d..f5d79c6
@@ -1,4 +1,4 @@
-## func
+## Certmaster
 ##
 ## Copyright 2007, Red Hat, Inc
 ## See AUTHORS
@@ -14,8 +14,8 @@
 
 
 import logging
-from func.config import read_config
-from func.commonconfig import FuncdConfig
+from config import read_config
+from commonconfig import CMConfig
 
 
 # from the comments in http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
@@ -31,18 +31,18 @@ class Singleton(object):
 class Logger(Singleton):
     _no_handlers = True
 
-    def __init__(self, logfilepath ="/var/log/func/func.log"):
-        config_file = '/etc/func/minion.conf'
-        self.config = read_config(config_file, FuncdConfig)    
+    def __init__(self, logfilepath ="/var/log/certmaster/certmaster.log"):
+        config_file = '/etc/certmaster/minion.conf'
+        self.config = read_config(config_file, CMConfig)
         self.loglevel = logging._levelNames[self.config.log_level]
         self._setup_logging()
         if self._no_handlers:
             self._setup_handlers(logfilepath=logfilepath)
-        
+
     def _setup_logging(self):
-        self.logger = logging.getLogger("svc")
+        self.logger = logging.getLogger("certmaster")
 
-    def _setup_handlers(self, logfilepath="/var/log/func/func.log"):
+    def _setup_handlers(self, logfilepath="/var/log/certmaster/certmaster.log"):
         handler = logging.FileHandler(logfilepath, "a")
         self.logger.setLevel(self.loglevel)
         formatter = logging.Formatter("%(asctime)s - %(levelname)s - %(message)s")
@@ -53,21 +53,22 @@ class Logger(Singleton):
 
 class AuditLogger(Singleton):
     _no_handlers = True
-    def __init__(self, logfilepath = "/var/log/func/audit.log"):
+    def __init__(self, logfilepath = "/var/log/certmaster/audit.log"):
+        self.logfilepath = logfilepath
         self.loglevel = logging.INFO
         self._setup_logging()
         if self._no_handlers:
             self._setup_handlers(logfilepath=logfilepath)
 
-    def log_call(self, ip, CN, cert_hash, method, params):
+    def log_call(self, ip, method, params):
         # square away a good parseable format at some point -akl
-        self.logger.info("%s %s %s %s called with %s" % (ip, CN, cert_hash, method, params))
+        self.logger.info("%s called %s with %s" % (ip, method, params))
 
 
     def _setup_logging(self):
-        self.logger = logging.getLogger("audit")
+        self.logger = logging.getLogger("certmaster-audit")
 
-    def _setup_handlers(self, logfilepath="/var/log/func/audit.log"):
+    def _setup_handlers(self, logfilepath="/var/log/certmaster/audit.log"):
         handler = logging.FileHandler(logfilepath, "a")
         self.logger.setLevel(self.loglevel)
         formatter = logging.Formatter("%(asctime)s - %(message)s")