ATLAS Offline Software
TileCalibLogger.py
Go to the documentation of this file.
1 #!/bin/env python
2 
3 # Copyright (C) 2002-2018 CERN for the benefit of the ATLAS collaboration
4 # TileCalibLogger.py
5 # Nils Gollub <nils.gollub@cern.ch>, 2007-11-29
6 
7 import logging
8 NAMELENGTH = 15
9 
10 #_____________________________________________________________________
11 def setupFormat(lvl=logging.INFO):
12  myFormat = "%%(name)-%is: %%(levelname)-8s %%(message)s" % NAMELENGTH
13  logging.basicConfig(format=myFormat, level=lvl)
14 
15 #_____________________________________________________________________
16 def getLogger(name="TileCalib"):
17  if len(name)>NAMELENGTH:
18  name = "..."+name[-NAMELENGTH+3:]
19  return logging.getLogger(name)
20 
21 #_____________________________________________________________________
23  """
24  Base class, providing logging functionality
25  """
26  __slots__ = ["_log"]
27  def __init__(self, name, lvl=logging.INFO):
28  self._log = getLogger(name)
29  self.setLogLvl(lvl)
30  def setLogLvl(self, lvl):
31  self._log.setLevel(lvl)
32  def getLogLvl(self, lvl):
33  self._log.getEffectiveLevel()
34  def log(self):
35  return self._log
36 
37 
38 #=== setup format
python.TileCalibLogger.TileCalibLogger.getLogLvl
def getLogLvl(self, lvl)
Definition: TileCalibLogger.py:32
python.TileCalibLogger.getLogger
def getLogger(name="TileCalib")
Definition: TileCalibLogger.py:16
pool::DbPrintLvl::setLevel
void setLevel(MsgLevel l)
Definition: DbPrint.h:32
python.TileCalibLogger.TileCalibLogger.__init__
def __init__(self, name, lvl=logging.INFO)
Definition: TileCalibLogger.py:27
python.TileCalibLogger.TileCalibLogger._log
_log
Definition: TileCalibLogger.py:28
python.TileCalibLogger.TileCalibLogger
Definition: TileCalibLogger.py:22
python.TileCalibLogger.TileCalibLogger.setLogLvl
def setLogLvl(self, lvl)
Definition: TileCalibLogger.py:30
python.TileCalibLogger.setupFormat
def setupFormat(lvl=logging.INFO)
Definition: TileCalibLogger.py:11
python.TileCalibLogger.TileCalibLogger.log
def log(self)
Definition: TileCalibLogger.py:34