aboutsummaryrefslogtreecommitdiffstats
path: root/pylog/onaplogging/mdcformatter.py
diff options
context:
space:
mode:
authorMichal Jagiello <michal.jagiello@t-mobile.pl>2020-07-02 12:34:25 +0000
committerMichal Jagiello <michal.jagiello@t-mobile.pl>2020-07-13 08:57:03 +0000
commitb437b2c38ec0d5bb234fef0459b0e0533d08b7af (patch)
treea234cd12effde9854b77ea3ceaa6848a80a241b0 /pylog/onaplogging/mdcformatter.py
parentd80e67cc8994fb0b92c8c1b5e3f51bde21b4a791 (diff)
Pylog test suite
Prepare test suite for onaplogging library. Add utils to check Python version. Issue-ID: LOG-1229 Signed-off-by: Michal Jagiello <michal.jagiello@t-mobile.pl> Change-Id: I12c431c10f61fceaf70d5ae36581dfd5a876ef72
Diffstat (limited to 'pylog/onaplogging/mdcformatter.py')
-rw-r--r--pylog/onaplogging/mdcformatter.py16
1 files changed, 8 insertions, 8 deletions
diff --git a/pylog/onaplogging/mdcformatter.py b/pylog/onaplogging/mdcformatter.py
index 545a4c1..4cacbe8 100644
--- a/pylog/onaplogging/mdcformatter.py
+++ b/pylog/onaplogging/mdcformatter.py
@@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-import sys
import logging
from .markerFormatter import MarkerFormatter
+from .utils import is_above_python_2_7, is_above_python_3_2
class MDCFormatter(MarkerFormatter):
@@ -33,12 +33,12 @@ class MDCFormatter(MarkerFormatter):
:param colorfmt: colored output with ANSI escape code on terminal
:param style: style mapping keys in python3
"""
- if sys.version_info > (3, 2):
+ if is_above_python_3_2():
super(MDCFormatter, self).__init__(fmt=fmt,
datefmt=datefmt,
colorfmt=colorfmt,
style=style)
- elif sys.version_info > (2, 7):
+ elif is_above_python_2_7():
super(MDCFormatter, self).__init__(fmt=fmt,
datefmt=datefmt,
colorfmt=colorfmt)
@@ -112,7 +112,7 @@ class MDCFormatter(MarkerFormatter):
"""
mdcIndex = self._fmt.find(self._mdc_tag)
if mdcIndex == -1:
- if sys.version_info > (2, 7):
+ if is_above_python_2_7():
return super(MDCFormatter, self).format(record)
else:
return MarkerFormatter.format(self, record)
@@ -121,10 +121,10 @@ class MDCFormatter(MarkerFormatter):
if mdcFmtWords is None:
self._fmt = self._fmt.replace(self._mdc_tag, "")
- if sys.version_info > (3, 2):
+ if is_above_python_3_2():
self._style = logging._STYLES[self.style][0](self._fmt)
- if sys.version_info > (2, 7):
+ if is_above_python_2_7():
return super(MDCFormatter, self).format(record)
else:
return MarkerFormatter.format(self, record)
@@ -142,10 +142,10 @@ class MDCFormatter(MarkerFormatter):
mdcstr = self._replaceStr(keys=mdcFmtkeys).format(**res)
self._fmt = self._fmt.replace(self._mdc_tag, mdcstr)
- if sys.version_info > (3, 2):
+ if is_above_python_3_2():
self._style = logging._STYLES[self.style][0](self._fmt)
- if sys.version_info > (2, 7):
+ if is_above_python_2_7():
return super(MDCFormatter, self).format(record)
else:
return MarkerFormatter.format(self, record)