1 # Copyright (C) 2008-2012 W. Trevor King <wking@tremily.us>
3 # This file is part of pycomedi.
5 # pycomedi is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation, either version 2 of the License, or (at your option) any later
10 # pycomedi is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License along with
15 # pycomedi. If not, see <http://www.gnu.org/licenses/>.
17 "A Pythonic wrapper around Comedilib"
19 import logging as _logging
25 LOG = _logging.getLogger('pycomedi')
28 LOG.setLevel(_logging.WARN)
29 h = _logging.StreamHandler()
30 f = _logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
36 class PyComediError (Exception):
38 def __init__(self, function_name=None, ret=None, comedi_msg=None,
40 self.function_name = function_name
42 self.comedi_msg = comedi_msg
43 self.error_msg = error_msg
45 msg = '{0} ({1}): {2} ({3})'.format(
46 function_name, error_msg, comedi_msg, ret)
48 msg = '{0}: {1} ({2})'.format(function_name, comedi_msg, ret)
49 super(PyComediError, self).__init__(msg)