File tree Expand file tree Collapse file tree 3 files changed +12
-3
lines changed
Expand file tree Collapse file tree 3 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -20,5 +20,6 @@ module.exports = {
2020 IDENTIFY_DELAY : 300000 , // 5 minutes delay if identifyApp call failed
2121 COOKIE_MASK : 'X-MASKED-X' , // cookie headers and values mask
2222 LOGGER_VERSION : 'Node.js Stackify v.1.0' ,
23+ WINSTON_LOGGER_VERSION : 'Node.js Winston-Stackify v.1.0' ,
2324 X_STACKIFY_PV : 'V1'
2425} ;
Original file line number Diff line number Diff line change 11var api = require ( './lib/api' ) , // wrappers for API calls
22 exception = require ( './lib/exception' ) , // exception handler module
3- logger = require ( './lib/logger' ) ; // logging methods module
3+ logger = require ( './lib/logger' ) , // logging methods module
4+ CONFIG = require ( './config/config' ) ;
45
56module . exports = {
67 // start sending logs
78 start : function ( options ) {
9+ CONFIG . SELECTED_LOGGER = CONFIG . LOGGER_VERSION ;
810 api . methods . identifyApp ( options ) ;
911 exception . catchException ( options . exitOnError || false ) ;
1012 exception . gracefulExitHandler ( ) ;
@@ -19,6 +21,12 @@ module.exports = {
1921
2022 //common method for handling logged messages
2123 push : logger . methods . push ,
24+ // setting logger name to Winston logger if it's used
25+ setLoggerName : function ( name ) {
26+ if ( name === 'Winston' ) {
27+ CONFIG . SELECTED_LOGGER = CONFIG . WINSTON_LOGGER_VERSION ;
28+ }
29+ } ,
2230
2331 expressExceptionHandler : exception . expressExceptionHandler
2432} ;
Original file line number Diff line number Diff line change @@ -94,7 +94,7 @@ module.exports.getTrace = function getTrace(err) {
9494 trace . forEach ( function ( val ) {
9595 var method = val . methodName || ( val . functionName || val . typeName ) + '.<anonymous>' ;
9696
97- if ( val . fileName ? ( val . fileName . search ( 'lib/logger.js' ) < 0 || val . fileName . search ( 'stackify' ) < 0 ) : true ) {
97+ if ( val . fileName ? ( val . fileName . search ( 'lib/logger.js' ) < 0 && val . fileName . search ( 'stackify' ) < 0 ) : true ) {
9898 result . push ( {
9999 CodeFileName : val . fileName ,
100100 LineNum : val . lineNumber ,
@@ -146,7 +146,7 @@ module.exports.getPostBody = function getPostBody(messages) {
146146 ServerName : os . hostname ( ) ,
147147 AppName : CONFIG . APPNAME ,
148148 AppLoc : process . env . PWD ,
149- Logger : CONFIG . LOGGER_VERSION ,
149+ Logger : CONFIG . SELECTED_LOGGER ,
150150 Platform : 'nodejs' ,
151151 Msgs : messages
152152 } ;
You can’t perform that action at this time.
0 commit comments