File: customlog.py

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 (26 lines) | stat: -rw-r--r-- 682 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
26
import io
import logging

import cssutils

EXPOUT = ""
EXPERR = """Property: Unknown Property name. [1:5: x]
HTTPError opening url=http://cthedot.de/x: 404 Not Found
CSSImportRule: While processing imported style sheet href=http://cthedot.de/x: IOError('Cannot read Stylesheet.',)
CSSStylesheet: CSSImportRule not allowed here. [1:13: @import]
"""


def main():
    mylog = io.StringIO()
    h = logging.StreamHandler(mylog)
    h.setFormatter(logging.Formatter('%(levelname)s    %(message)s'))
    cssutils.log.setLevel(logging.INFO)

    cssutils.parseString('a { x: 1; } @import "http://cthedot.de/x";')

    cssutils.log.removeHandler(h)


if __name__ == '__main__':
    main()