4 Copyright (c) 2011-2016 ARM Limited 6 Licensed under the Apache License, Version 2.0 (the "License"); 7 you may not use this file except in compliance with the License. 8 You may obtain a copy of the License at 10 http://www.apache.org/licenses/LICENSE-2.0 12 Unless required by applicable law or agreed to in writing, software 13 distributed under the License is distributed on an "AS IS" BASIS, 14 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 See the License for the specific language governing permissions and 16 limitations under the License. 22 from functools
import partial
26 """! Yet another logger flavour """ 28 logging.basicConfig(stream=sys.stdout,format=
'[%(created).2f][%(name)s]%(message)s', level=logging.DEBUG)
29 self.
logger = logging.getLogger(name)
32 def __prn_log(self, logger_level, text, timestamp=None):
34 'logger_level' : logger_level,
38 self.
prn_dbg = partial(__prn_log, self,
'DBG')
39 self.
prn_wrn = partial(__prn_log, self,
'WRN')
40 self.
prn_err = partial(__prn_log, self,
'ERR')
41 self.
prn_inf = partial(__prn_log, self,
'INF')
42 self.
prn_txt = partial(__prn_log, self,
'TXT')
43 self.
prn_txd = partial(__prn_log, self,
'TXD')
44 self.
prn_rxd = partial(__prn_log, self,
'RXD')
Yet another logger flavour.