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>
24 LOGLEVEL = os.environ.get("NEPI_LOGLEVEL", "INFO").upper()
25 LOGLEVEL = getattr(logging, LOGLEVEL)
26 FORMAT = "%(asctime)s %(name)s %(levelname)-4s %(message)s"
28 # NEPI_LOG variable contains space separated components
29 # on which logging should be enabled
30 LOG = os.environ.get("NEPI_LOG", "ALL").upper()
33 # Set by default loglevel to error
34 logging.basicConfig(format = FORMAT, level = logging.ERROR)
36 # Set logging level to that defined by the user
37 # only for the enabled components
38 for component in LOG.split(" "):
40 log = logging.getLogger(component)
41 log.setLevel(LOGLEVEL)
43 err = traceback.format_exc()
46 # Set the logging level defined by the user for all
48 logging.basicConfig(format = FORMAT, level = LOGLEVEL)
51 # Add RMs to ResourceFactory. Use NEPI_SEARCH_PATH to
52 # override the default path to search for RMs
53 from nepi.execution.resource import populate_factory