[go: up one dir, main page]

File: utils.py

package info (click to toggle)
stomper 0.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch
  • size: 252 kB
  • ctags: 296
  • sloc: python: 1,363; makefile: 12
file content (22 lines) | stat: -rw-r--r-- 577 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
22
"""
This module contains various utility functions used in various locations.

(c) Oisin Mulvihill, 2007-07-28.
License: http://www.apache.org/licenses/LICENSE-2.0

"""
import logging


def log_init(level):
    """Set up a logger that catches all channels and logs it to stdout.
    
    This is used to set up logging when testing.
    
    """
    log = logging.getLogger()
    hdlr = logging.StreamHandler()
    formatter = logging.Formatter('%(asctime)s %(name)s %(levelname)s %(message)s')
    hdlr.setFormatter(formatter)
    log.addHandler(hdlr)
    log.setLevel(level)