~ubuntu-branches/ubuntu/trusty/pyzmq/trusty

« back to all changes in this revision

Viewing changes to buildutils/msg.py

  • Committer: Package Import Robot
  • Author(s): Julian Taylor
  • Date: 2013-02-24 19:23:15 UTC
  • mfrom: (2.1.3 experimental)
  • Revision ID: package-import@ubuntu.com-20130224192315-9xkzrza97h674d07
Tags: 2.2.0.1-1
* New upstream release
* relicense debian packaging to LGPL-3
* update watch file to use github directly
  thanks to Bart Martens for the file
* add autopkgtests
* drop obsolete DM-Upload-Allowed
* bump standard to 3.9.4, no changes required

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""logging"""
 
2
#-----------------------------------------------------------------------------
 
3
#  Copyright (C) 2011 Brian Granger, Min Ragan-Kelley
 
4
#
 
5
#  This file is part of pyzmq, copied and adapted from h5py.
 
6
#  h5py source used under the New BSD license
 
7
#
 
8
#  h5py: <http://code.google.com/p/h5py/>
 
9
#
 
10
#  Distributed under the terms of the New BSD License.  The full license is in
 
11
#  the file COPYING.BSD, distributed as part of this software.
 
12
#-----------------------------------------------------------------------------
 
13
 
 
14
from __future__ import division
 
15
 
 
16
import sys
 
17
import logging
 
18
 
 
19
#-----------------------------------------------------------------------------
 
20
# Logging (adapted from h5py: http://h5py.googlecode.com)
 
21
#-----------------------------------------------------------------------------
 
22
 
 
23
 
 
24
logger = logging.getLogger()
 
25
logger.setLevel(logging.INFO)
 
26
logger.addHandler(logging.StreamHandler(sys.stderr))
 
27
 
 
28
def debug(msg):
 
29
    logger.debug(msg)
 
30
 
 
31
def info(msg):
 
32
    logger.info(msg)
 
33
 
 
34
def fatal(msg, code=1):
 
35
    logger.error("Fatal: " + msg)
 
36
    exit(code)
 
37
 
 
38
def warn(msg):
 
39
    logger.error("Warning: " + msg)
 
40
 
 
41
def line(c='*', width=48):
 
42
    print(c * (width // len(c)))
 
43