2017-12-12 55 views
0

私はhapiサーバーに良いプラグインを登録しています。私の応答はすべてログインしています。console.logconsole.errorconsole.warnconsole.infoすべてのログはプレーンテキスト良いプラグインの方法ではありません。正常なモジュールが正常に動作していません

私が逃した可能性のあるものは誰でも助けてくれますか?

私は、次のドキュメントを読んでいる:

答えて

0

にconsole.logは自然にコンソールになります。あなたが使用をコンソールに物事を印刷するような何かしたい場合:

request.server.log(['error', 'contentFetch'], err);

をこれは多分あなたは捨てると何かがあなたのために働く見つけることができます私の良いプラグインの設定です。

logging: { 
     $filter: 'env', 
     production: { 
      reporters: { 
       file: [{ 
        module: 'good-squeeze', 
        name: 'Squeeze', 
        args: [{error: '*', log: ['error'], ops: '*'}] 
       }, { 
        module: 'good-squeeze', 
        name: 'SafeJson', 
        args: [ 
         null, 
         {separator: '\n'} 
        ] 
       }, { 
        module: 'rotating-file-stream', 
        args: [ 
         'error.log', 
         { 
          size: '10M', // rotate every 10 MegaBytes written 
          interval: '1d', // rotate daily 
          compress: 'gzip', // compress rotated files 
          path: './logs' 
         } 
        ] 
       }] 
      } 
     }, 
     $default: { 
      ops: { 
       interval: 1000 
      }, 
      reporters: { 
       console: [{ 
        module: 'good-squeeze', 
        name: 'Squeeze', 
        args: [{log: '*', response: '*'}] 
       }, { 
        module: 'good-console' 
       }, 'stdout'] 
      } 
     } 
    }, 

この

{ 
     plugin: { 
      register: 'good', 
      options: Config.get('/logging') 
     } 
    } 
のように登録します
関連する問題