2 # NEPI, a framework to manage network experiments
3 # Copyright (C) 2013 INRIA
5 # This program is free software: you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation, either version 3 of the License, or
8 # (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
26 LOGLEVEL = os.environ.get("NEPI_LOGLEVEL", "INFO").upper()
27 LOGLEVEL = getattr(logging, LOGLEVEL)
28 FORMAT = "%(asctime)s %(name)s %(levelname)-4s %(message)s"
30 # NEPI_LOG variable contains space separated components
31 # on which logging should be enabled
32 LOG = os.environ.get("NEPI_LOG", "ALL").upper()
35 # Set by default loglevel to error
36 logging.basicConfig(format = FORMAT, level = logging.ERROR)
38 # Set logging level to that defined by the user
39 # only for the enabled components
40 for component in LOG.split(" "):
42 log = logging.getLogger(component)
43 log.setLevel(LOGLEVEL)
45 err = traceback.format_exc()
48 # Set the logging level defined by the user for all
50 logging.basicConfig(format = FORMAT, level = LOGLEVEL)
53 # Add RMs to ResourceFactory. Use NEPI_SEARCH_PATH to
54 # override the default path to search for RMs
55 from nepi.execution.resource import populate_factory