]> git.proxmox.com Git - mirror_novnc.git/commitdiff
Standardize on camelCase in Logging
authorSamuel Mannehed <samuel@cendio.se>
Sun, 31 May 2020 21:24:58 +0000 (23:24 +0200)
committerSamuel Mannehed <samuel@cendio.se>
Sun, 31 May 2020 21:37:29 +0000 (23:37 +0200)
app/ui.js
app/webutil.js
core/util/logging.js
tests/test.util.js

index 7207b2ffd02cb6ea00c6d80ba6b38e664e4f682e..d0ec5238d6de132353476f7224a0cd9333407022 100644 (file)
--- a/app/ui.js
+++ b/app/ui.js
@@ -1683,7 +1683,7 @@ const UI = {
     },
 
     updateLogging() {
-        WebUtil.init_logging(UI.getSetting('logging'));
+        WebUtil.initLogging(UI.getSetting('logging'));
     },
 
     updateDesktopName(e) {
index e552d421386756e7f02c63641a781b877e3e56d7..0c4823f1c03cb92f33aceed74f0cf17dd22e59e6 100644 (file)
@@ -6,16 +6,16 @@
  * See README.md for usage and integration instructions.
  */
 
-import { init_logging as main_init_logging } from '../core/util/logging.js';
+import { initLogging as mainInitLogging } from '../core/util/logging.js';
 
 // init log level reading the logging HTTP param
-export function init_logging(level) {
+export function initLogging(level) {
     "use strict";
     if (typeof level !== "undefined") {
-        main_init_logging(level);
+        mainInitLogging(level);
     } else {
         const param = document.location.href.match(/logging=([A-Za-z0-9._-]*)/);
-        main_init_logging(param || undefined);
+        mainInitLogging(param || undefined);
     }
 }
 
index 8978a07518c1da6d3283212ea4267cc8876f8893..fe449e935154b6a1612ca4e6cdfec18801100517 100644 (file)
  * Logging/debug routines
  */
 
-let _log_level = 'warn';
+let _logLevel = 'warn';
 
 let Debug = () => {};
 let Info = () => {};
 let Warn = () => {};
 let Error = () => {};
 
-export function init_logging(level) {
+export function initLogging(level) {
     if (typeof level === 'undefined') {
-        level = _log_level;
+        level = _logLevel;
     } else {
-        _log_level = level;
+        _logLevel = level;
     }
 
     Debug = Info = Warn = Error = () => {};
@@ -46,11 +46,11 @@ export function init_logging(level) {
     }
 }
 
-export function get_logging() {
-    return _log_level;
+export function getLogging() {
+    return _logLevel;
 }
 
 export { Debug, Info, Warn, Error };
 
 // Initialize logging level
-init_logging();
+initLogging();
index fb1d03733145505631eca45428d8f5b72f13df4b..cd61f248a9e378ea4ed6403a0354135f74db509c 100644 (file)
@@ -22,37 +22,37 @@ describe('Utils', function () {
             console.warn.restore();
             console.error.restore();
             console.info.restore();
-            Log.init_logging();
+            Log.initLogging();
         });
 
         it('should use noop for levels lower than the min level', function () {
-            Log.init_logging('warn');
+            Log.initLogging('warn');
             Log.Debug('hi');
             Log.Info('hello');
             expect(console.log).to.not.have.been.called;
         });
 
         it('should use console.debug for Debug', function () {
-            Log.init_logging('debug');
+            Log.initLogging('debug');
             Log.Debug('dbg');
             expect(console.debug).to.have.been.calledWith('dbg');
         });
 
         it('should use console.info for Info', function () {
-            Log.init_logging('debug');
+            Log.initLogging('debug');
             Log.Info('inf');
             expect(console.info).to.have.been.calledWith('inf');
         });
 
         it('should use console.warn for Warn', function () {
-            Log.init_logging('warn');
+            Log.initLogging('warn');
             Log.Warn('wrn');
             expect(console.warn).to.have.been.called;
             expect(console.warn).to.have.been.calledWith('wrn');
         });
 
         it('should use console.error for Error', function () {
-            Log.init_logging('error');
+            Log.initLogging('error');
             Log.Error('err');
             expect(console.error).to.have.been.called;
             expect(console.error).to.have.been.calledWith('err');