From 29419d03cd645c7ce2949e6d11738543bb534d89 Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 30 Oct 2017 07:04:59 +0100 Subject: [PATCH] avoid logs polluting the unit test output --- js/privatebin.js | 16 ++++++++-------- js/test.js | 4 ++-- tpl/bootstrap.php | 2 +- tpl/page.php | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/js/privatebin.js b/js/privatebin.js index f818b98..c9ff5a8 100644 --- a/js/privatebin.js +++ b/js/privatebin.js @@ -414,7 +414,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { var orgArguments = arguments; $(document).on(languageLoadedEvent, function () { // log to show that the previous error could be mitigated - console.log('Fix missing translation of \'' + messageId + '\' with now loaded language ' + language); + console.warn('Fix missing translation of \'' + messageId + '\' with now loaded language ' + language); // re-execute this function me.translate.apply(this, orgArguments); }); @@ -1100,7 +1100,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { */ me.showStatus = function(message, icon, dismissable, autoclose) { - console.log('status shown: ', message); + console.info('status shown: ', message); // @TODO: implement dismissable // @TODO: implement autoclose @@ -1143,7 +1143,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { */ me.showRemaining = function(message) { - console.log('remaining message shown: ', message); + console.info('remaining message shown: ', message); handleNotification(1, $remainingTime, message); } @@ -1161,7 +1161,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { me.showLoading = function(message, percentage, icon) { if (typeof message !== 'undefined' && message !== null) { - console.log('status changed: ', message); + console.info('status changed: ', message); } // default message text @@ -2656,7 +2656,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { me.showViewButtons = function() { if (viewButtonsDisplayed) { - console.log('showViewButtons: view buttons are already displayed'); + console.warn('showViewButtons: view buttons are already displayed'); return; } @@ -2676,7 +2676,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { me.hideViewButtons = function() { if (!viewButtonsDisplayed) { - console.log('hideViewButtons: view buttons are already hidden'); + console.warn('hideViewButtons: view buttons are already hidden'); return; } @@ -2708,7 +2708,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { me.showCreateButtons = function() { if (createButtonsDisplayed) { - console.log('showCreateButtons: create buttons are already displayed'); + console.warn('showCreateButtons: create buttons are already displayed'); return; } @@ -2733,7 +2733,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) { me.hideCreateButtons = function() { if (!createButtonsDisplayed) { - console.log('hideCreateButtons: create buttons are already hidden'); + console.warn('hideCreateButtons: create buttons are already hidden'); return; } diff --git a/js/test.js b/js/test.js index bd0fb02..03b817b 100644 --- a/js/test.js +++ b/js/test.js @@ -25,8 +25,8 @@ global.RawDeflate.inflate = require('./rawinflate-0.3').RawDeflate.inflate; require('./privatebin'); // redirect console messages to log file -console.warn = console.error = function (msg) { - logFile.write(msg + '\n'); +console.info = console.warn = console.error = function () { + logFile.write(Array.prototype.slice.call(arguments).join('') + '\n'); } describe('Helper', function () { diff --git a/tpl/bootstrap.php b/tpl/bootstrap.php index 036452e..3695fd2 100644 --- a/tpl/bootstrap.php +++ b/tpl/bootstrap.php @@ -69,7 +69,7 @@ if ($MARKDOWN): - + diff --git a/tpl/page.php b/tpl/page.php index 1cae6b3..1f75a60 100644 --- a/tpl/page.php +++ b/tpl/page.php @@ -47,7 +47,7 @@ if ($MARKDOWN): - +