mirror of
https://github.com/getpelican/pelican.git
synced 2025-10-15 20:28:56 +02:00
Merge pull request #2763 from kernc/root-logger
Force root logger to be of FatalLogger class
This commit is contained in:
commit
4d70447a5a
3 changed files with 9 additions and 3 deletions
|
|
@ -76,10 +76,14 @@ section.
|
||||||
The only rule to follow for plugins is to define a ``register`` callable, in
|
The only rule to follow for plugins is to define a ``register`` callable, in
|
||||||
which you map the signals to your plugin logic. Let's take a simple example::
|
which you map the signals to your plugin logic. Let's take a simple example::
|
||||||
|
|
||||||
|
import logging
|
||||||
|
|
||||||
from pelican import signals
|
from pelican import signals
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
def test(sender):
|
def test(sender):
|
||||||
print("{} initialized !!".format(sender))
|
log.debug("%s initialized !!", sender)
|
||||||
|
|
||||||
def register():
|
def register():
|
||||||
signals.initialized.connect(test)
|
signals.initialized.connect(test)
|
||||||
|
|
|
||||||
|
|
@ -742,8 +742,8 @@ Time and Date
|
||||||
|
|
||||||
.. parsed-literal::
|
.. parsed-literal::
|
||||||
|
|
||||||
LOCALE = ('usa', 'jpn', # On Windows
|
LOCALE = ('usa', 'jpn', # On Windows
|
||||||
'en_US', 'ja_JP' # On Unix/Linux
|
'en_US', 'ja_JP' # On Unix/Linux
|
||||||
)
|
)
|
||||||
|
|
||||||
For a list of available locales refer to `locales on Windows`_ or on
|
For a list of available locales refer to `locales on Windows`_ or on
|
||||||
|
|
|
||||||
|
|
@ -165,6 +165,8 @@ class FatalLogger(LimitLogger):
|
||||||
|
|
||||||
|
|
||||||
logging.setLoggerClass(FatalLogger)
|
logging.setLoggerClass(FatalLogger)
|
||||||
|
# force root logger to be of our preferred class
|
||||||
|
logging.getLogger().__class__ = FatalLogger
|
||||||
|
|
||||||
|
|
||||||
def supports_color():
|
def supports_color():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue