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)
|
||||||
|
|
|
||||||
|
|
@ -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