diff options
Diffstat (limited to 'BuildManager/__init__.py')
-rw-r--r-- | BuildManager/__init__.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/BuildManager/__init__.py b/BuildManager/__init__.py new file mode 100644 index 0000000..eea669a --- /dev/null +++ b/BuildManager/__init__.py @@ -0,0 +1,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() + |