public void log ( ConsumerJournalEntry journalEntry ) { StringBuffer buffer = new StringBuffer ( ) ; buffer . append ( "Event: method='" ) . append ( journalEntry . getMethodName ( ) ) . append ( "', " ) . append ( journalEntry . getIdentifier ( ) ) . append ( "\n" ) ; if ( logLevel == LEVEL_HIGH ) { JournalEntryContext context = journalEntry . getContext ( ) ; buffer . append ( " context=" ) . append ( context . getClass ( ) . getName ( ) ) . append ( "\n" ) ; buffer . append ( writeMapValues ( "environmentAttributes" , context . getEnvironmentAttributes ( ) ) ) ; buffer . append ( writeMapValues ( "subjectAttributes" , context . getSubjectAttributes ( ) ) ) ; buffer . append ( writeMapValues ( "actionAttributes" , context . getActionAttributes ( ) ) ) ; buffer . append ( writeMapValues ( "resourceAttributes" , context . getResourceAttributes ( ) ) ) ; buffer . append ( writeMapValues ( "recoveryAttributes" , context . getRecoveryAttributes ( ) ) ) ; buffer . append ( " password='*********'\n" ) ; buffer . append ( " noOp=" ) . append ( context . getNoOp ( ) ) . append ( "\n" ) ; } if ( logLevel == LEVEL_HIGH || logLevel == LEVEL_MEDIUM ) { buffer . append ( " now=" + journalEntry . getContext ( ) . getNoOp ( ) + "\n" ) ; buffer . append ( " arguments\n" ) ; Map < String , Object > argumentsMap = journalEntry . getArgumentsMap ( ) ; for ( Iterator < String > names = argumentsMap . keySet ( ) . iterator ( ) ; names . hasNext ( ) ; ) { String name = names . next ( ) ; Object value = argumentsMap . get ( name ) ; if ( value instanceof String [ ] ) { buffer . append ( writeStringArray ( name , ( String [ ] ) value ) ) ; } else { buffer . append ( " " + name + "='" + value + "'\n" ) ; } } } log ( buffer . toString ( ) ) ; }
Format a journal entry for writing to the logger . Take logging level into account .