From 97dcced0609f4f8a5ff3fbf3ca90f4060f693d9f Mon Sep 17 00:00:00 2001 From: jasonkneen Date: Fri, 21 Apr 2017 16:38:01 +0100 Subject: [PATCH] logging tweaks --- reste.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/reste.js b/reste.js index 5377b92..d4b1ef9 100644 --- a/reste.js +++ b/reste.js @@ -8,14 +8,16 @@ var main = function() { // generic log handler in DEV mode function log(message) { - if (config.debug) { + if (config.debug && message) { console.log("::RESTE::" + message); } } // generic log handler in DEV mode function warn(message) { - console.warn("::RESTE::" + message); + if (config.debug && message) { + console.warn("::RESTE::" + message); + } } // sets up the config, headers, adds methods @@ -154,7 +156,7 @@ var main = function() { e.url = args.url; function retry() { - log("Retrying"); + log("Retrying..."); makeHttpRequest(args, onLoad, onError); } @@ -457,7 +459,7 @@ var main = function() { // Intercept sync to handle collections / models Backbone.sync = function(method, model, options) { if (config.debug) { - log(method + model._type); + log("Backbone.sync: " + method + model._type); }