Skip to content

Commit

Permalink
Merge pull request #3257 from MinchinWeb/real-logging
Browse files Browse the repository at this point in the history
  • Loading branch information
justinmayer authored Jan 9, 2024
2 parents 2d75ca8 + 4ed5c0d commit af37f06
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pelican/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down

0 comments on commit af37f06

Please sign in to comment.