blob: eea669a1120c6fc56f953e4096b898a9d1927418 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import logging
import sys, os
__all__ = ["Error", "logger"]
class Error(Exception): pass
def getlogger():
class Formatter(logging.Formatter):
def format(self, record):
if record.levelname == "INFO":
record.llevelname = ""
else:
record.llevelname = record.levelname.lower()+": "
return logging.Formatter.format(self, record)
formatter = Formatter("%(llevelname)s%(message)s")
handler = logging.StreamHandler(sys.stderr)
handler.setFormatter(formatter)
logger = logging.getLogger("bm")
logger.addHandler(handler)
return logger
logger = getlogger()
|