Commit 6e1f863b authored by Stavros Sachtouris's avatar Stavros Sachtouris
Browse files

Use < and > in stream logger for send/recv resp.

parent 9986e569
......@@ -173,17 +173,18 @@ def _setup_logging(silent=False, debug=False, verbose=False, include=False):
add_stream_logger(__name__, logging.CRITICAL)
return
sfmt, rfmt = '> %(message)s', '< %(message)s'
if debug:
add_stream_logger('kamaki.clients.send', logging.DEBUG)
add_stream_logger('kamaki.clients.recv', logging.DEBUG)
add_stream_logger('kamaki.clients.send', logging.DEBUG, sfmt)
add_stream_logger('kamaki.clients.recv', logging.DEBUG, rfmt)
add_stream_logger(__name__, logging.DEBUG)
elif verbose:
add_stream_logger('kamaki.clients.send', logging.INFO)
add_stream_logger('kamaki.clients.recv', logging.INFO)
add_stream_logger('kamaki.clients.send', logging.INFO, sfmt)
add_stream_logger('kamaki.clients.recv', logging.INFO, rfmt)
add_stream_logger(__name__, logging.INFO)
if include:
add_stream_logger('kamaki.clients.send', logging.INFO)
add_stream_logger('kamaki.clients.recv', logging.INFO)
add_stream_logger('kamaki.clients.send', logging.INFO, sfmt)
add_stream_logger('kamaki.clients.recv', logging.INFO, rfmt)
add_stream_logger(__name__, logging.WARNING)
global kloger
kloger = get_logger(__name__)
......
......@@ -76,9 +76,9 @@ def add_file_logger(name, level=None, filename=None):
return get_logger(name)
def add_stream_logger(name, level=None):
def add_stream_logger(name, level=None, fmt=None):
try:
return _add_logger(name, level)
return _add_logger(name, level, fmt=fmt)
except Exception:
return get_logger(name)
......
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