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 version 2 as
7 # published by the Free Software Foundation;
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Author: Alina Quereilhac <alina.quereilhac@inria.fr>
19 from __future__ import print_function
25 LOGLEVEL = os.environ.get("NEPI_LOGLEVEL", "INFO").upper()
26 LOGLEVEL = getattr(logging, LOGLEVEL)
27 FORMAT = "%(asctime)s %(name)s %(levelname)-4s %(message)s"
29 # NEPI_LOG variable contains space separated components
30 # on which logging should be enabled
31 LOG = os.environ.get("NEPI_LOG", "ALL").upper()
34 # Set by default loglevel to error
35 logging.basicConfig(format = FORMAT, level = logging.ERROR)
37 # Set logging level to that defined by the user
38 # only for the enabled components
39 for component in LOG.split(" "):
41 log = logging.getLogger(component)
42 log.setLevel(LOGLEVEL)
44 err = traceback.format_exc()
47 # Set the logging level defined by the user for all
49 logging.basicConfig(format = FORMAT, level = LOGLEVEL)
52 # Add RMs to ResourceFactory. Use NEPI_SEARCH_PATH to
53 # override the default path to search for RMs
54 from nepi.execution.resource import populate_factory
57 from nepi.util.version import version_tag