[Groonga-commit] groonga/gcs [master] Don't exit on error

アーカイブの一覧に戻る

YUKI Hiroshi null+****@clear*****
Mon Nov 5 10:50:36 JST 2012


YUKI Hiroshi	2012-11-05 10:50:36 +0900 (Mon, 05 Nov 2012)

  New Revision: 2c430e069c0821a879d923815611bacfcc524d17
  https://github.com/groonga/gcs/commit/2c430e069c0821a879d923815611bacfcc524d17

  Log:
    Don't exit on error

  Modified files:
    lib/logger.js

  Modified: lib/logger.js (+8 -3)
===================================================================
--- lib/logger.js    2012-11-02 17:57:54 +0900 (debe1e4)
+++ lib/logger.js    2012-11-05 10:50:36 +0900 (969109c)
@@ -8,15 +8,19 @@ function getLogger(context) {
 
   var logger = new winston.Logger({
         transports: [
-          new winston.transports.Console()
-        ]
+          new winston.transports.Console({ json: false, timestamp: true })
+        ],
+        exceptionHandlers: [
+          new winston.transports.Console({ json: false, timestamp: true })
+        ],
+        exitOnError: false
       });
   return loggers[context] = logger;
 }
 
 function logError(error) {
   var message = error;
-  if (error.stack) {
+  if (error && error.stack) {
     message = error + '\n' + error.stack;
   }
   getLogger('error').error(message);
@@ -33,5 +37,6 @@ exports.query = logQuery;
 function setLogFilePath(context, path) {
   var logger = getLogger(context);
   logger.add(winston.transports.File, { filename: path });
+  logger.add(winston.transports.File, { filename: path, handleExceptions: true });
 }
 exports.setLogFilePath = setLogFilePath;
-------------- next part --------------
HTML����������������������������...
ダウンロード 



More information about the Groonga-commit mailing list
アーカイブの一覧に戻る