demos/demobase.py
author Radek Brich <radek.brich@devl.cz>
Wed, 26 Mar 2014 21:26:39 +0100
changeset 92 b97c4e25ed6d
child 96 68c562e0eb1f
permissions -rw-r--r--
Configure logging for demos.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
92
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     1
import sys
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     2
sys.path.append('..')
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     3
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     4
import logging
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     5
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     6
# Setup logging
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     7
logger = logging.getLogger('tuikit')
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     8
logger.setLevel(logging.DEBUG)
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
     9
handler = logging.FileHandler(filename='tuikit.log')
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    10
handler.setLevel(logging.DEBUG)
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    11
formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s')
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    12
handler.setFormatter(formatter)
b97c4e25ed6d Configure logging for demos.
Radek Brich <radek.brich@devl.cz>
parents:
diff changeset
    13
logger.addHandler(handler)