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>
23 def __init__(self, logger_component):
24 self._logger = logging.getLogger(logger_component)
26 def debug(self, msg, out = None, err = None):
27 self.log(msg, logging.DEBUG, out, err)
29 def error(self, msg, out = None, err = None):
30 self.log(msg, logging.ERROR, out, err)
32 def warning(self, msg, out = None, err = None):
33 self.log(msg, logging.WARNING, out, err)
35 def info(self, msg, out = None, err = None):
36 self.log(msg, logging.INFO, out, err)
38 def log(self, msg, level, out = None, err = None):
40 msg += " - OUT: %s " % out
43 msg += " - ERROR: %s " % err
45 msg = self.log_message(msg)
47 self.logger.log(level, msg)
49 def log_message(self, msg):