5 LOGLEVEL = os.environ.get("NEPI_LOGLEVEL", "INFO").upper()
6 LOGLEVEL = getattr(logging, LOGLEVEL)
7 #FORMAT = "%(asctime)s %(name)-12s %(levelname)-8s %(message)s"
8 FORMAT = "%(asctime)s %(name)s %(levelname)-4s %(message)s"
10 # NEPI_LOG variable contains space separated components
11 # on which logging should be enabled
12 LOG = os.environ.get("NEPI_LOG", "ALL").upper()
15 # Set by default loglevel to error
16 logging.basicConfig(format = FORMAT, level = logging.ERROR)
18 # Set logging level to that defined by the user
19 # only for the enabled components
20 for component in LOG.split(" "):
22 log = logging.getLogger(component)
23 log.setLevel(LOGLEVEL)
25 err = traceback.format_exc()
28 # Set the logging level defined by the user for all
30 logging.basicConfig(format = FORMAT, level = LOGLEVEL)