public static void logCall ( long entryTime , long returnTime , int callIndex , Object returnValue , Object argValues [ ] , long streamId ) { if ( ! API_TRACE_LOG . isInfoEnabled ( ) ) { return ; } // determine elapsed time long elapsed = returnTime ; elapsed -= entryTime ; entryTime -= baseTime ; // TODO: for the first entry, we get negatives for entryTime. // is this something weird in order the Java instantiates? // append universal fields (i.e., ones that occur for every call) StringBuilder line = new StringBuilder ( ) ; line . append ( pid + "," ) ; line . append ( nextEventId . getAndIncrement ( ) + "," ) ; line . append ( entryTime + "," ) ; line . append ( elapsed + "," ) ; line . append ( callIndex + "," ) ; line . append ( streamId + "," ) ; line . append ( escape ( returnValue ) ) ; // append the args to the method call if ( argValues != null ) { for ( int i = 0 ; i < argValues . length ; i ++ ) { line . append ( "," + escape ( argValues [ i ] ) ) ; } } API_TRACE_LOG . info ( line ) ; }
Record a method call and its return value in the log .