@@ -95,7 +95,9 @@ exports.init = function init(userConfig = {}) {
9595 parentLogger = uninstrumentedLogger ( {
9696 name : '@instana/collector' ,
9797 level : 'info' ,
98- base : { threadId, pid : process . pid , hostname : os . hostname ( ) }
98+ base : { threadId, pid : process . pid , hostname : os . hostname ( ) } ,
99+ // Set ISO timestamp format for the default logger
100+ timestamp : ( ) => `,"time":"${ new Date ( ) . toISOString ( ) } "`
99101 } ) ;
100102 }
101103
@@ -133,12 +135,17 @@ exports.init = function init(userConfig = {}) {
133135
134136 // CASE: We copy any settings from the pino instance such as custom formats.
135137 if ( symbols && Array . isArray ( symbols ) ) {
138+ // If there's a custom timestamp function from the userConfig logger , we'll respect that
136139 const timeSym = symbols . find ( sym => String ( sym ) === 'Symbol(pino.time)' ) ;
137140 // @ts -ignore
138141 const timestampFn = instance [ timeSym ] ;
139142
140- if ( timestampFn ) {
143+ // Only use the user's timestamp function if it's from a user-provided logger
144+ if ( timestampFn && userConfig . logger ) {
141145 pinoOpts . timestamp = timestampFn ;
146+ } else if ( ! pinoOpts . timestamp ) {
147+ // If no timestamp function is set yet, fallback to ISO format
148+ pinoOpts . timestamp = ( ) => `,"time":"${ new Date ( ) . toISOString ( ) } "` ;
142149 }
143150
144151 const formattersSym = symbols . find ( sym => String ( sym ) === 'Symbol(pino.formatters)' ) ;
0 commit comments