Skip to content
Permalink
Browse files
Add NIKOLA_SHOW_TRACEBACKS environment variable
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 3, 2017
1 parent 208dfac commit 1779cb7b3cfa2f89c3896d575ae7603934b58ff6
Showing with 10 additions and 5 deletions.
  1. +2 −0 CHANGES.txt
  2. +2 −1 docs/manual.txt
  3. +1 −0 nikola/__init__.py
  4. +3 −3 nikola/__main__.py
  5. +2 −1 nikola/nikola.py
@@ -4,6 +4,8 @@ New in master
Features
--------

* Add ``NIKOLA_SHOW_TRACEBACKS`` environment variable that shows
full tracebacks instead of one-line summaries
* Use ``PRETTY_URLS`` by default on all sites (Issue #1838)
* Feed link generation is completely refactored (Issue #2844)
* Added ``extract_metadata`` and ``split_metadata`` to the
@@ -2862,7 +2862,8 @@ stderr. Thus, you must use the different call. (Alternatively, you could run
with ``nikola build -v 2``, which disables the redirections.)

To show more logging messages, as well as full tracebacks, you need to set an
environment variable: ``NIKOLA_DEBUG=1``
environment variable: ``NIKOLA_DEBUG=1``. If you want to only see tracebacks,
set ``NIKOLA_SHOW_TRACEBACKS=1``.

Shell Tab Completion
~~~~~~~~~~~~~~~~~~~~
@@ -31,6 +31,7 @@

__version__ = '8.0.0.dev0'
DEBUG = bool(os.getenv('NIKOLA_DEBUG'))
SHOW_TRACEBACKS = bool(os.getenv('NIKOLA_SHOW_TRACEBACKS'))

if sys.version_info[0] == 2:
raise Exception("Nikola does not support Python 2.")
@@ -280,7 +280,7 @@ def load_tasks(self, cmd, opt_values, pos_args):
signal('initialized').send(self.nikola)
except Exception:
LOGGER.error('Error loading tasks. An unhandled exception occurred.')
if self.nikola.debug:
if self.nikola.debug or self.nikola.show_tracebacks:
raise
_print_exception()
sys.exit(3)
@@ -369,7 +369,7 @@ def run(self, cmd_args):
return super(DoitNikola, self).run(cmd_args)
except Exception:
LOGGER.error('An unhandled exception occurred.')
if self.nikola.debug:
if self.nikola.debug or self.nikola.show_tracebacks:
raise
_print_exception()
return 1
@@ -412,7 +412,7 @@ def _print_exception():
"""Print an exception in a friendlier, shorter style."""
etype, evalue, _ = sys.exc_info()
LOGGER.error(''.join(traceback.format_exception(etype, evalue, None, limit=0, chain=False)).strip())
LOGGER.notice("To see more details, run Nikola in debug mode (set environment variable NIKOLA_DEBUG=1)")
LOGGER.notice("To see more details, run Nikola in debug mode (set environment variable NIKOLA_DEBUG=1) or use NIKOLA_SHOW_TRACEBACKS=1")


if __name__ == "__main__":
@@ -60,7 +60,7 @@

from .post import Post # NOQA
from .state import Persistor
from . import DEBUG, filters, utils, hierarchy_utils, shortcodes
from . import DEBUG, SHOW_TRACEBACKS, filters, utils, hierarchy_utils, shortcodes
from .plugin_categories import (
Command,
LateTask,
@@ -413,6 +413,7 @@ def __init__(self, **config):
self._MESSAGES = None
self.filters = {}
self.debug = DEBUG
self.show_tracebacks = SHOW_TRACEBACKS
self.colorful = config.pop('__colorful__', False)
self.invariant = config.pop('__invariant__', False)
self.quiet = config.pop('__quiet__', False)

0 comments on commit 1779cb7

Please sign in to comment.