File: logging.rst

package info (click to toggle)
cssutils 2.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,312 kB
  • sloc: python: 23,625; javascript: 803; sh: 62; makefile: 8
file content (25 lines) | stat: -rw-r--r-- 950 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
.. module:: cssutils.errorhandler

.. index::
    single: log, cssutils.log
    pair: object; cssutils.log

logging
=======

A global logger is used throughout the library. You may configure it or even replace it with your own. Customizing the default log should be sufficient for most purposes though.

The default logger is available as ``cssutils.log``. It has the following methods which are basically the same as defined for standard ``logging`` loggers:

* ``log.setLevel(level)`` and ``log.getEffectiveLevel()``, example::

    import logging
    cssutils.log.setLevel(logging.FATAL)

* ``log.addHandler(h)`` and ``log.removeHandler(h)``
* ``log.*(msg)`` where ``*`` is one of ``debug``, ``info``, ``warn``, ``error`` or ``fatal``/``critical``

Additional method: ``cssutils.log.setLog(newlog)``: To replace the default log which sends output to ``stderr``.


See also :meth:`cssutils.css.Property.validate` for details on how properties log.