From: Brian Dolbec Date: Sat, 22 Jun 2013 19:41:31 +0000 (-0700) Subject: Make the logger, namespace able. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=11795d9e10e11000dbf36397f4870fed5635bdc8;p=gentoo-keys.git Make the logger, namespace able. --- diff --git a/gkeyldap/cli.py b/gkeyldap/cli.py index 21e551f..8d9dc85 100644 --- a/gkeyldap/cli.py +++ b/gkeyldap/cli.py @@ -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) diff --git a/gkeys/cli.py b/gkeys/cli.py index b9846d9..47c8777 100644 --- a/gkeys/cli.py +++ b/gkeys/cli.py @@ -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 diff --git a/gkeys/log.py b/gkeys/log.py index c0a33e7..4608eba 100644 --- a/gkeys/log.py +++ b/gkeys/log.py @@ -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) +