File: customlog.py

package info (click to toggle)
cssutils 0.9.10-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 2,320 kB
  • ctags: 1,991
  • sloc: python: 19,781; sh: 102; makefile: 79
file content (21 lines) | stat: -rw-r--r-- 758 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import logging, StringIO

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

def main():
    import cssutils

    mylog = StringIO.StringIO()
    h = logging.StreamHandler(mylog)
    h.setFormatter(logging.Formatter('%(levelname)s    %(message)s'))
    #cssutils.log.addHandler(h)
    cssutils.log.setLevel(logging.INFO)

    sheet = cssutils.parseString('a { x: 1; } @import "http://cthedot.de/x";')
    #print mylog.getvalue()

    cssutils.log.removeHandler(h)

if __name__ == '__main__':
    main()