1 # -------------------------------------------------------------------------
2 # Copyright (c) 2020 AT&T Intellectual Property
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 # -------------------------------------------------------------------------
21 from onaplogging.colorFormatter import RESET
22 from onaplogging.mdcformatter import MDCFormatter
25 class OOFMDCFormatter(MDCFormatter):
30 def __init__(self, fmt=None, mdcfmt=None,
31 datefmt=None, colorfmt=None, style="%"):
32 super().__init__(fmt, mdcfmt, datefmt, colorfmt, style)
33 self.converter = time.gmtime
35 def _replaceStr(self, keys):
36 """overriding the default behavior
38 keys: keys that needs to be substituted
43 fmt = fmt.replace(i, i)
47 def format(self, record):
48 """Removing the color format end of line character.
51 return super(OOFMDCFormatter, self).format(record).replace(RESET, '')