1 # Copyright (C) 2011-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 "Wrap library-wide Comedi functions in a `Device` class"
21 from pycomedi cimport _comedilib_h
22 from . import constant as _constant
25 def set_loglevel(level):
26 """Control the verbosity of Comedilib debugging and error messages
28 This function affects the output of debugging and error messages
29 from Comedilib. By increasing the loglevel, additional debugging
30 information will be printed. Error and debugging messages are
31 printed to the stream stderr.
33 The default loglevel can be set by using the environment variable
34 COMEDI_LOGLEVEL. The default loglevel is 1.
36 In order to conserve resources, some debugging information is
37 disabled by default when Comedilib is compiled.
39 See `constants.LOGLEVEL` for a list of possible levels and their
45 This function returns the previous loglevel.
47 >>> from constant import LOGLEVEL
48 >>> level = set_loglevel(LOGLEVEL.error)
51 >>> set_loglevel(level)
54 ret = _comedilib_h.comedi_loglevel(_constant.bitwise_value(level))
55 return _constant.LOGLEVEL.index_by_value(ret)