From 739a185d1b642ebd5f7ecd33acce47927f64bb5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gina=20H=C3=A4u=C3=9Fge?= Date: Tue, 12 May 2015 12:22:10 +0200 Subject: [PATCH] Logging for flask view caching --- src/octoprint/server/util/flask.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/octoprint/server/util/flask.py b/src/octoprint/server/util/flask.py index 57501908..e1aa70e2 100644 --- a/src/octoprint/server/util/flask.py +++ b/src/octoprint/server/util/flask.py @@ -121,12 +121,12 @@ def cached(timeout=5 * 60, key=lambda: "view/%s" % flask.request.path, unless=No # bypass the cache if "unless" condition is true if callable(unless) and unless(): - logger.debug("Cache bypassed, calling wrapped function") + logger.debug("Cache for {path} bypassed, calling wrapped function".format(path=flask.request.path)) return f(*args, **kwargs) # also bypass the cache if it's disabled completely if not settings().getBoolean(["devel", "cache", "enabled"]): - logger.debug("Cache disabled, calling wrapped function") + logger.debug("Cache for {path} disabled, calling wrapped function".format(path=flask.request.path)) return f(*args, **kwargs) cache_key = key() @@ -135,11 +135,11 @@ def cached(timeout=5 * 60, key=lambda: "view/%s" % flask.request.path, unless=No if not callable(refreshif) or not refreshif(): rv = _cache.get(cache_key) if rv is not None: - logger.debug("Serving entry from cache") + logger.debug("Serving entry for {path} from cache".format(path=flask.request.path)) return rv # get value from wrapped function - logger.debug("No cache entry or refreshing cache, calling wrapped function") + logger.debug("No cache entry or refreshing cache for {path}, calling wrapped function".format(path=flask.request.path)) rv = f(*args, **kwargs) # store it in the cache