浏览代码

feat: remove or disable useless logging

Acathur 5 年之前
父节点
当前提交
9394bcef6f
共有 5 个文件被更改,包括 11 次插入15 次删除
  1. 0 2
      kaifain_v2/utils/request.ts
  2. 5 5
      middleware/initialize.js
  3. 4 4
      plugins/router.js
  4. 0 2
      router/index.js
  5. 2 2
      store/index.ts

+ 0 - 2
kaifain_v2/utils/request.ts

@@ -1,8 +1,6 @@
 import { ProginnRequest } from 'proginn-lib'
 import { MAIN_ENDPOINT } from '../constant'
 
-console.log('[debug]', process.env.NODE_ENV, MAIN_ENDPOINT)
-
 class RequestError extends Error {
   status: any
   url!: string

+ 5 - 5
middleware/initialize.js

@@ -12,7 +12,7 @@ export default function (context) {
     console.log(req.url)
 
     let host = req.headers.host;
-    console.log("initialize...........req.............header");
+    // console.log("initialize...........req.............header");
     let proto = "https";
     if (req.headers["x-forwarded-proto"]) {
       proto = req.headers["x-forwarded-proto"];
@@ -27,14 +27,14 @@ export default function (context) {
   }
   // Client-side
   if (process.client) {
-    console.log("client side............");
+    // console.log("client side............");
     url = document.location.href;
     let proto = "http";
     if (url.indexOf("https://") != -1) {
       proto = "https";
     }
     cookies = document.cookie;
-    console.log("client", document.location)
+    // console.log("client", document.location)
   }
   let groups = {}
   try {
@@ -42,7 +42,7 @@ export default function (context) {
       "((?<branch>[a-z0-9_\\-]+)\\.)?(?<env>(www|prod|test|local|test-rooter|test-jishuin|prod-rooter|prod-jishuin|rooter|jishuin|app|test-kaifain|prod-kaifain|kaifain|test-job|job|prod-job|local-rooter|local-job|local-jishuin|local-kaifain))\\.proginn\\.com(\\:(?<port>\\d+))?",
       "gim"
     );
-    console.log(regx);
+    // console.log(regx);
     console.log(url);
     groups = regx.exec(url).groups;
   } catch (e) {
@@ -67,7 +67,7 @@ export default function (context) {
     kaifainUrl = "",
     jobUrl = "",
     urlType = "";
-  console.log(groups);
+  // console.log(groups);
   if (groups) {
     let {
       branch,

+ 4 - 4
plugins/router.js

@@ -4,8 +4,8 @@ export default ({ app, context, req, store}) => {
     const isKaifain = host.indexOf('kaifain') !== -1
     const isJishuin = host.indexOf('jishuin') !== -1
     const isJob = host.indexOf('job') !== -1
-    console.log('before Route Path', window.__NUXT__.routePath)
-    console.log("app.router.options.routes", app.router.options.routes)
+    // console.log('before Route Path', window.__NUXT__.routePath)
+    // console.log("app.router.options.routes", app.router.options.routes)
     /* if (isKaifain) {
       window.__NUXT__.routePath = app.context.route.path.replace(/^\/kaifain/, '/')
       let kaifainIndex = app.router.options.routes.filter(v => v.name === 'kaifain')[0]
@@ -121,9 +121,9 @@ export default ({ app, context, req, store}) => {
         console.log(e)
       }
     }
-    console.log('router', app.router)
+    // console.log('router', app.router)
     app.router.beforeEach((to, from, next) => {
-      console.log("beforeEach", to, from)
+      // console.log("beforeEach", to, from)
       next()
     })
   }

+ 0 - 2
router/index.js

@@ -8,8 +8,6 @@ const JISHUIN = 'jishuin'
 const RE_IPV4 = /^(\d+.)+\d+$/
 
 const getServerHostname = ({ req }) => {
-  console.log('@ctx.req', req.url)
-  console.log('@ctx.req.headers', req.headers)
   const { host, referer } = req.headers
   let hostname = host.split(':')[0]
 

+ 2 - 2
store/index.ts

@@ -28,8 +28,8 @@ export const getters = {
 };
 export const mutations = {
   updateDomainConfig(state, config) {
-    console.log("update-----------store-----------");
-    console.log(config);
+    // console.log("update-----------store-----------");
+    // console.log(config);
     state.domainConfig = {
       api: config.api,
       siteUrl: config.siteUrl,