Prechádzať zdrojové kódy

avoid logs polluting the unit test output

El RIDO 8 rokov pred
rodič
commit
29419d03cd
4 zmenil súbory, kde vykonal 12 pridanie a 12 odobranie
  1. 8 8
      js/privatebin.js
  2. 2 2
      js/test.js
  3. 1 1
      tpl/bootstrap.php
  4. 1 1
      tpl/page.php

+ 8 - 8
js/privatebin.js

@@ -414,7 +414,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
                     var orgArguments = arguments;
                     var orgArguments = arguments;
                     $(document).on(languageLoadedEvent, function () {
                     $(document).on(languageLoadedEvent, function () {
                         // log to show that the previous error could be mitigated
                         // 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
                         // re-execute this function
                         me.translate.apply(this, orgArguments);
                         me.translate.apply(this, orgArguments);
                     });
                     });
@@ -1100,7 +1100,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
          */
          */
         me.showStatus = function(message, icon, dismissable, autoclose)
         me.showStatus = function(message, icon, dismissable, autoclose)
         {
         {
-            console.log('status shown: ', message);
+            console.info('status shown: ', message);
             // @TODO: implement dismissable
             // @TODO: implement dismissable
             // @TODO: implement autoclose
             // @TODO: implement autoclose
 
 
@@ -1143,7 +1143,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
          */
          */
         me.showRemaining = function(message)
         me.showRemaining = function(message)
         {
         {
-            console.log('remaining message shown: ', message);
+            console.info('remaining message shown: ', message);
             handleNotification(1, $remainingTime, message);
             handleNotification(1, $remainingTime, message);
         }
         }
 
 
@@ -1161,7 +1161,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
         me.showLoading = function(message, percentage, icon)
         me.showLoading = function(message, percentage, icon)
         {
         {
             if (typeof message !== 'undefined' && message !== null) {
             if (typeof message !== 'undefined' && message !== null) {
-                console.log('status changed: ', message);
+                console.info('status changed: ', message);
             }
             }
 
 
             // default message text
             // default message text
@@ -2656,7 +2656,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
         me.showViewButtons = function()
         me.showViewButtons = function()
         {
         {
             if (viewButtonsDisplayed) {
             if (viewButtonsDisplayed) {
-                console.log('showViewButtons: view buttons are already displayed');
+                console.warn('showViewButtons: view buttons are already displayed');
                 return;
                 return;
             }
             }
 
 
@@ -2676,7 +2676,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
         me.hideViewButtons = function()
         me.hideViewButtons = function()
         {
         {
             if (!viewButtonsDisplayed) {
             if (!viewButtonsDisplayed) {
-                console.log('hideViewButtons: view buttons are already hidden');
+                console.warn('hideViewButtons: view buttons are already hidden');
                 return;
                 return;
             }
             }
 
 
@@ -2708,7 +2708,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
         me.showCreateButtons = function()
         me.showCreateButtons = function()
         {
         {
             if (createButtonsDisplayed) {
             if (createButtonsDisplayed) {
-                console.log('showCreateButtons: create buttons are already displayed');
+                console.warn('showCreateButtons: create buttons are already displayed');
                 return;
                 return;
             }
             }
 
 
@@ -2733,7 +2733,7 @@ jQuery.PrivateBin = function($, sjcl, Base64, RawDeflate) {
         me.hideCreateButtons = function()
         me.hideCreateButtons = function()
         {
         {
             if (!createButtonsDisplayed) {
             if (!createButtonsDisplayed) {
-                console.log('hideCreateButtons: create buttons are already hidden');
+                console.warn('hideCreateButtons: create buttons are already hidden');
                 return;
                 return;
             }
             }
 
 

+ 2 - 2
js/test.js

@@ -25,8 +25,8 @@ global.RawDeflate.inflate = require('./rawinflate-0.3').RawDeflate.inflate;
 require('./privatebin');
 require('./privatebin');
 
 
 // redirect console messages to log file
 // 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 () {
 describe('Helper', function () {

+ 1 - 1
tpl/bootstrap.php

@@ -69,7 +69,7 @@ if ($MARKDOWN):
 <?php
 <?php
 endif;
 endif;
 ?>
 ?>
-		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-QHNQsevnuA9oHZp2BV0Bi/hyf99g6+H/C2BhSnmlbyxU1SFXiLQvu43xdEl8qvZSoS2zf0R6rgH0sbSeVsrqsQ==" crossorigin="anonymous"></script>
+		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-FyLKI8IhQHnJ24H05KGlzJGOht+xoMUj7Io5BL02qGUzdL6bXGPiQlmTOlbxAwDo0x+AP9m1pfGpI3UbC0T0sw==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->
 		<![endif]-->

+ 1 - 1
tpl/page.php

@@ -47,7 +47,7 @@ if ($MARKDOWN):
 <?php
 <?php
 endif;
 endif;
 ?>
 ?>
-		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-QHNQsevnuA9oHZp2BV0Bi/hyf99g6+H/C2BhSnmlbyxU1SFXiLQvu43xdEl8qvZSoS2zf0R6rgH0sbSeVsrqsQ==" crossorigin="anonymous"></script>
+		<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-FyLKI8IhQHnJ24H05KGlzJGOht+xoMUj7Io5BL02qGUzdL6bXGPiQlmTOlbxAwDo0x+AP9m1pfGpI3UbC0T0sw==" crossorigin="anonymous"></script>
 		<!--[if lt IE 10]>
 		<!--[if lt IE 10]>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
 		<![endif]-->
 		<![endif]-->