fonttools/Lib/fontTools/__init__.py
Cosimo Lupo 6eac5d05c0 [fontTools.__init__] use 'lastResort' handler instead of NullHandler
I think it's better to follow the current Python 3 behavior in the situation
where the user doesn't provide any explicit logging configuration.

Before Python 3.2, when no handlers were found when a logging event occurred,
either the events would be silently dropped (if logging.raiseExceptions is
set to False), or it would throw a single "No handlers could be found" warning
(this was the default behavior).

With Python 3.2 and later, the default behavior is that the events are output
using a "handler of last resort". The latter works like StreamHandler
that writes messages (without formatting) to the current value of sys.stderr
(thus respecting any redirections which may be in effect).
2016-01-29 18:44:43 +00:00

17 lines
546 B
Python

from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
import logging
from fontTools.misc.loggingTools import Logger, configLogger
# set the logging.Logger class to one which supports the "last resort" handler,
# to be used when the client doesn't explicitly configure logging.
# It prints the bare message to sys.stderr, only for events of severity WARNING
# or greater.
logging.setLoggerClass(Logger)
log = logging.getLogger(__name__)
version = "3.0"
__all__ = ["version", "log", "configLogger"]