1 # Copyright (C) 2011-2012 W. Trevor King <wking@drexel.edu>
3 # This file is part of pycomedi.
5 # pycomedi is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by the
7 # Free Software Foundation, either version 2 of the License, or (at your
8 # option) any later version.
10 # pycomedi is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 # General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with pycomedi. If not, see <http://www.gnu.org/licenses/>.
18 "Wrap library-wide Comedi functions in a `Device` class"
23 import constant as _constant
26 def set_loglevel(level):
27 """Control the verbosity of Comedilib debugging and error messages
29 This function affects the output of debugging and error messages
30 from Comedilib. By increasing the loglevel, additional debugging
31 information will be printed. Error and debugging messages are
32 printed to the stream stderr.
34 The default loglevel can be set by using the environment variable
35 COMEDI_LOGLEVEL. The default loglevel is 1.
37 In order to conserve resources, some debugging information is
38 disabled by default when Comedilib is compiled.
40 See `constants.LOGLEVEL` for a list of possible levels and their
46 This function returns the previous loglevel.
48 >>> from constant import LOGLEVEL
49 >>> level = set_loglevel(LOGLEVEL.error)
52 >>> set_loglevel(level)
55 ret = _comedilib_h.comedi_loglevel(_constant.bitwise_value(level))
56 return _constant.LOGLEVEL.index_by_value(ret)