Make the logger, namespace able.
authorBrian Dolbec <dolsen@gentoo.org>
Sat, 22 Jun 2013 19:41:31 +0000 (12:41 -0700)
committerBrian Dolbec <dolsen@gentoo.org>
Sun, 23 Jun 2013 04:30:59 +0000 (21:30 -0700)
gkeyldap/cli.py
gkeys/cli.py
gkeys/log.py

index 21e551f3955de573d17e85a7efd7e76e51e99a72..8d9dc85e0a4db1e1facb8cb9a2167bb97fda1646 100644 (file)
@@ -7,7 +7,10 @@ import sys
 import os
 import argparse
 
+from gkeys import log
+log.set_logger('gkeyldap')
 from gkeys.log import logger
+
 from gkeys.config import GKeysConfig, GKEY
 from gkeys.seed import Seeds
 from gkeyldap.search import (LdapSearch, UID, gkey2ldap_map, gkey2SEARCH)
index b9846d965ef84cb16005026a4d6cf0f84c0ae1bf..47c8777be420ee982f906b2bb2a16292b330ab11 100644 (file)
@@ -16,7 +16,10 @@ from __future__ import print_function
 import argparse
 import sys
 
+from gkeys import log
+log.set_logger('gkeys')
 from gkeys.log import logger
+
 from gkeys.config import GKeysConfig, GKEY
 from gkeys.seed import Seeds
 
index c0a33e7466c7f3c471cefdfae9be6fb5808845f5..4608ebaf84296523a8de09e876bb2721d8819c9c 100644 (file)
@@ -14,5 +14,15 @@ import logging
 
 logging.basicConfig()
 
-logger = logging.getLogger('gentoo-keys')
+NAMESPACE = 'gentoo-keys'
+logger = None
+
+def set_logger(namespace=None):
+    global logger, NAMESPACE
+    if not namespace:
+        namespace = Namespace
+    else:
+        NAMESPACE = namespace
+    logger = logging.getLogger(namespace)
+