diff options
author | evasquez <eric.vasquez@calxeda.com> | 2013-12-17 15:59:37 -0600 |
---|---|---|
committer | evasquez <eric.vasquez@calxeda.com> | 2013-12-17 16:00:06 -0600 |
commit | 5cb7f8af710627b90bb38f9b5ece5c0ebc3bdfde (patch) | |
tree | 95993995255e9318856481b8bcd527642913cc2c | |
parent | d03c73ce29a1476cc7665bef6619c8faa6331570 (diff) | |
download | cxmanage-5cb7f8af710627b90bb38f9b5ece5c0ebc3bdfde.tar.gz |
AIT-622: Add pretty print formatting to loggers.
Signed-off-by: evasquez <eric.vasquez@calxeda.com>
-rw-r--r-- | cxmanage_api/loggers.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/cxmanage_api/loggers.py b/cxmanage_api/loggers.py index 26edf21..777faed 100644 --- a/cxmanage_api/loggers.py +++ b/cxmanage_api/loggers.py @@ -39,6 +39,7 @@ target. import os +import pprint import datetime import traceback @@ -100,7 +101,14 @@ class Logger(object): :type level_tag: string """ - lines = msg.split('\n') + lines = pprint.pformat(msg).splitlines() + if len(lines) == 1: + # + # We don't care about single line formatting. + # Make sure we get __str__ instead of __repr___ + # + lines = str(msg).splitlines() + result = [] for line in lines: if (self.time_stamp): |