ATLAS Offline Software
CaloCondLogger.py
Go to the documentation of this file.
1 #!/bin/env python
2 
3 # Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
4 # CaloCondLogger.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="CaloCond"):
17  if len(name)>NAMELENGTH:
18  name = "..."+name[-NAMELENGTH+3:]
19  return logging.getLogger(name)
20 
21 #_____________________________________________________________________
23  """
24  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 #=== setup format
python.CaloCondLogger.setupFormat
def setupFormat(lvl=logging.INFO)
Definition: CaloCondLogger.py:11
python.CaloCondLogger.CaloCondLogger.log
def log(self)
Definition: CaloCondLogger.py:34
pool::DbPrintLvl::setLevel
void setLevel(MsgLevel l)
Definition: DbPrint.h:32
python.CaloCondLogger.CaloCondLogger.getLogLvl
def getLogLvl(self, lvl)
Definition: CaloCondLogger.py:32
python.CaloCondLogger.CaloCondLogger.setLogLvl
def setLogLvl(self, lvl)
Definition: CaloCondLogger.py:30
python.CaloCondLogger.CaloCondLogger
Definition: CaloCondLogger.py:22
python.CaloCondLogger.CaloCondLogger._log
_log
Definition: CaloCondLogger.py:28
python.CaloCondLogger.CaloCondLogger.__init__
def __init__(self, name, lvl=logging.INFO)
Definition: CaloCondLogger.py:27
python.CaloCondLogger.getLogger
def getLogger(name="CaloCond")
Definition: CaloCondLogger.py:16