Commit 61ca0ecd authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Create get_logger, add_logger methods in clients

parent 59f71e99
......@@ -35,15 +35,16 @@ from urllib2 import quote
from threading import Thread
from json import dumps, loads
from time import time
import logging
from kamaki.clients.utils import get_logger
from kamaki.clients.connection.kamakicon import KamakiHTTPConnection
from kamaki.clients.connection.errors import KamakiConnectionError
from kamaki.clients.connection.errors import KamakiResponseError
sendlog = logging.getLogger('clients.send')
datasendlog = logging.getLogger('data.send')
recvlog = logging.getLogger('clients.recv')
datarecvlog = logging.getLogger('data.recv')
sendlog = get_logger('clients.send')
datasendlog = get_logger('data.send')
recvlog = get_logger('clients.recv')
datarecvlog = get_logger('data.recv')
class ClientError(Exception):
......
......@@ -31,6 +31,21 @@
# interpreted as representing official policies, either expressed
# or implied, of GRNET S.A.
import logging
def add_logger(name, level, prefix=''):
h = logging.StreamHandler()
fmt = logging.Formatter(prefix + '%(message)s')
h.setFormatter(fmt)
logger = logging.getLogger(name)
logger.addHandler(h)
logger.setLevel(level)
def get_logger(name):
return logging.getLogger(name)
def _matches(val1, val2, exactMath=True):
"""Case Insensitive match"""
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment