Yuki Takei 7 лет назад
Родитель
Сommit
532a0af864
2 измененных файлов с 15 добавлено и 5 удалено
  1. 4 1
      config/logger/config.dev.js
  2. 11 4
      resource/js/app.js

+ 4 - 1
config/logger/config.dev.js

@@ -1,7 +1,7 @@
 module.exports = {
 module.exports = {
   default: 'info',
   default: 'info',
 
 
-  //// configure level for name
+  //// configure level for server
   // 'express:*': 'debug',
   // 'express:*': 'debug',
   // 'growi:*': 'debug',
   // 'growi:*': 'debug',
   'growi:crowi': 'debug',
   'growi:crowi': 'debug',
@@ -14,4 +14,7 @@ module.exports = {
   // 'growi:routes:page': 'debug',
   // 'growi:routes:page': 'debug',
   // 'growi-plugin:*': 'debug',
   // 'growi-plugin:*': 'debug',
   // 'growi:InterceptorManager': 'debug',
   // 'growi:InterceptorManager': 'debug',
+
+  //// configure level for client
+  'growi:app': 'debug',
 };
 };

+ 11 - 4
resource/js/app.js

@@ -7,6 +7,7 @@ import io from 'socket.io-client';
 
 
 import i18nFactory from './i18n';
 import i18nFactory from './i18n';
 
 
+import loggerFactory from '@alias/logger';
 import Xss from '../../lib/util/xss';
 import Xss from '../../lib/util/xss';
 
 
 import Crowi from './util/Crowi';
 import Crowi from './util/Crowi';
@@ -39,6 +40,8 @@ import CustomHeaderEditor from './components/Admin/CustomHeaderEditor';
 
 
 import * as entities from 'entities';
 import * as entities from 'entities';
 
 
+const logger = loggerFactory('growi:app');
+
 if (!window) {
 if (!window) {
   window = {};
   window = {};
 }
 }
@@ -463,24 +466,26 @@ function updatePageStatusAlert(page, user) {
   }
   }
 }
 }
 socket.on('page:create', function(data) {
 socket.on('page:create', function(data) {
-  console.log(data);
   // skip if triggered myself
   // skip if triggered myself
   if (data.socketClientId != null && data.socketClientId === socketClientId) {
   if (data.socketClientId != null && data.socketClientId === socketClientId) {
     return;
     return;
   }
   }
 
 
+  logger.debug({ obj: data }, `websocket on 'page:create'`); // eslint-disable-line quotes
+
   // update PageStatusAlert
   // update PageStatusAlert
   if (data.page.path == pagePath) {
   if (data.page.path == pagePath) {
     updatePageStatusAlert(data.page, data.user);
     updatePageStatusAlert(data.page, data.user);
   }
   }
 });
 });
 socket.on('page:update', function(data) {
 socket.on('page:update', function(data) {
-  console.log(data);
   // skip if triggered myself
   // skip if triggered myself
   if (data.socketClientId != null && data.socketClientId === socketClientId) {
   if (data.socketClientId != null && data.socketClientId === socketClientId) {
     return;
     return;
   }
   }
 
 
+  logger.debug({ obj: data }, `websocket on 'page:update'`); // eslint-disable-line quotes
+
   if (data.page.path == pagePath) {
   if (data.page.path == pagePath) {
     // update PageStatusAlert
     // update PageStatusAlert
     updatePageStatusAlert(data.page, data.user);
     updatePageStatusAlert(data.page, data.user);
@@ -494,24 +499,26 @@ socket.on('page:update', function(data) {
   }
   }
 });
 });
 socket.on('page:delete', function(data) {
 socket.on('page:delete', function(data) {
-  console.log(data);
   // skip if triggered myself
   // skip if triggered myself
   if (data.socketClientId != null && data.socketClientId === socketClientId) {
   if (data.socketClientId != null && data.socketClientId === socketClientId) {
     return;
     return;
   }
   }
 
 
+  logger.debug({ obj: data }, `websocket on 'page:delete'`); // eslint-disable-line quotes
+
   // update PageStatusAlert
   // update PageStatusAlert
   if (data.page.path == pagePath) {
   if (data.page.path == pagePath) {
     updatePageStatusAlert(data.page, data.user);
     updatePageStatusAlert(data.page, data.user);
   }
   }
 });
 });
 socket.on('page:editingWithHackmd', function(data) {
 socket.on('page:editingWithHackmd', function(data) {
-  console.log(data);
   // skip if triggered myself
   // skip if triggered myself
   if (data.socketClientId != null && data.socketClientId === socketClientId) {
   if (data.socketClientId != null && data.socketClientId === socketClientId) {
     return;
     return;
   }
   }
 
 
+  logger.debug({ obj: data }, `websocket on 'page:editingWithHackmd'`); // eslint-disable-line quotes
+
   if (data.page.path == pagePath) {
   if (data.page.path == pagePath) {
     // update PageStatusAlert
     // update PageStatusAlert
     const pageStatusAlert = componentInstances.pageStatusAlert;
     const pageStatusAlert = componentInstances.pageStatusAlert;