forked from github/pelican
Merge pull request #3257 from MinchinWeb/real-logging
This commit is contained in:
commit
af37f0656f
1 changed files with 4 additions and 2 deletions
|
|
@ -85,13 +85,15 @@ class FatalLogger(LimitLogger):
|
|||
warnings_fatal = False
|
||||
errors_fatal = False
|
||||
|
||||
# adding `stacklevel=2` means that the displayed filename and line number
|
||||
# will match the "original" calling location, rather than the wrapper here
|
||||
def warning(self, *args, **kwargs):
|
||||
super().warning(*args, **kwargs)
|
||||
super().warning(*args, stacklevel=2, **kwargs)
|
||||
if FatalLogger.warnings_fatal:
|
||||
raise RuntimeError("Warning encountered")
|
||||
|
||||
def error(self, *args, **kwargs):
|
||||
super().error(*args, **kwargs)
|
||||
super().error(*args, stacklevel=2, **kwargs)
|
||||
if FatalLogger.errors_fatal:
|
||||
raise RuntimeError("Error encountered")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue