forked from github/pelican
Merge pull request #874 from avaris/non-ascii-error
Handle critical exception logging correctly in localized systems
This commit is contained in:
commit
2482baf837
1 changed files with 7 additions and 1 deletions
|
|
@ -378,7 +378,13 @@ def main():
|
|||
pelican.run()
|
||||
|
||||
except Exception as e:
|
||||
logger.critical(e)
|
||||
# localized systems have errors in native language if locale is set
|
||||
# so convert the message to unicode with the correct encoding
|
||||
msg = str(e)
|
||||
if not six.PY3:
|
||||
msg = msg.decode(locale.getpreferredencoding(False))
|
||||
|
||||
logger.critical(msg)
|
||||
|
||||
if (args.verbosity == logging.DEBUG):
|
||||
raise
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue