protected void logEvent ( FaxClientSpiProxyEventType eventType , Method method , Object [ ] arguments , Object output , Throwable throwable ) { //init log data int amount = 3 ; int argumentsAmount = 0 ; if ( arguments != null ) { argumentsAmount = arguments . length ; } if ( eventType == FaxClientSpiProxyEventType . POST_EVENT_TYPE ) { amount = amount + 2 ; } Object [ ] logData = new Object [ amount + argumentsAmount ] ; //set log data values switch ( eventType ) { case PRE_EVENT_TYPE : logData [ 0 ] = "Invoking " ; break ; case POST_EVENT_TYPE : logData [ 0 ] = "Invoked " ; break ; case ERROR_EVENT_TYPE : logData [ 0 ] = "Error while invoking " ; break ; } logData [ 1 ] = method . getName ( ) ; if ( argumentsAmount > 0 ) { logData [ 2 ] = " with data: " ; System . arraycopy ( arguments , 0 , logData , 3 , argumentsAmount ) ; } else { logData [ 2 ] = "" ; } if ( eventType == FaxClientSpiProxyEventType . POST_EVENT_TYPE ) { logData [ 3 + argumentsAmount ] = "\nOutput: " ; logData [ 4 + argumentsAmount ] = output ; } //get logger Logger logger = this . getLogger ( ) ; //log event switch ( eventType ) { case PRE_EVENT_TYPE : case POST_EVENT_TYPE : logger . logDebug ( logData , throwable ) ; break ; case ERROR_EVENT_TYPE : logger . logError ( logData , throwable ) ; break ; } }
This function logs the event .