@Test public void testGetMessage() { LogMessage msg = new LogMessage( "m {0}, {1}, {2}, {3}, {4,number,#.00}, {5} {foe}", "Channel 01", new Object[] { "Foo", "{abc}", "", null, 123 }, LogLevel.DEBUG ); assertEquals( "m Foo, {abc}, , null, 123.00, {5} {foe}", msg.getMessage() ); }
@Override public String getMessage() { String formatted = message; if ( arguments != null ) { final List<String> tokens = new ArrayList<>(); StringUtil.getUsedVariables( formatted, "{", "}", tokens, true ); for ( final String token : tokens ) { try { MessageFormat.format( "{" + token + "}", arguments ); } catch ( final IllegalArgumentException iar ) { formatted = formatted.replaceAll( "\\{" + token + "\\}", "\\'{'" + token + "\\'}'" ); } } formatted = MessageFormat.format( formatted, arguments ); } return formatted; }
LogMessage implements LogMessageInterface { @Override public String getMessage() { String formatted = message; if ( arguments != null ) { final List<String> tokens = new ArrayList<>(); StringUtil.getUsedVariables( formatted, "{", "}", tokens, true ); for ( final String token : tokens ) { try { MessageFormat.format( "{" + token + "}", arguments ); } catch ( final IllegalArgumentException iar ) { formatted = formatted.replaceAll( "\\{" + token + "\\}", "\\'{'" + token + "\\'}'" ); } } formatted = MessageFormat.format( formatted, arguments ); } return formatted; } }
LogMessage implements LogMessageInterface { @Override public String getMessage() { String formatted = message; if ( arguments != null ) { final List<String> tokens = new ArrayList<>(); StringUtil.getUsedVariables( formatted, "{", "}", tokens, true ); for ( final String token : tokens ) { try { MessageFormat.format( "{" + token + "}", arguments ); } catch ( final IllegalArgumentException iar ) { formatted = formatted.replaceAll( "\\{" + token + "\\}", "\\'{'" + token + "\\'}'" ); } } formatted = MessageFormat.format( formatted, arguments ); } return formatted; } LogMessage( String subject, LogLevel level );  LogMessage( String message, String logChannelId, LogLevel level );  LogMessage( String message, String logChannelId, Object[] arguments, LogLevel level ); }
LogMessage implements LogMessageInterface { @Override public String getMessage() { String formatted = message; if ( arguments != null ) { final List<String> tokens = new ArrayList<>(); StringUtil.getUsedVariables( formatted, "{", "}", tokens, true ); for ( final String token : tokens ) { try { MessageFormat.format( "{" + token + "}", arguments ); } catch ( final IllegalArgumentException iar ) { formatted = formatted.replaceAll( "\\{" + token + "\\}", "\\'{'" + token + "\\'}'" ); } } formatted = MessageFormat.format( formatted, arguments ); } return formatted; } LogMessage( String subject, LogLevel level );  LogMessage( String message, String logChannelId, LogLevel level );  LogMessage( String message, String logChannelId, Object[] arguments, LogLevel level ); @Override @Deprecated String toString(); @Override LogLevel getLevel(); @Deprecated void setLevel( LogLevel level ); @Override String getMessage(); @Deprecated void setMessage( String message ); @Override String getSubject(); @Deprecated void setSubject( String subject ); @Override String getLogChannelId(); @Deprecated void setLogChannelId( String logChannelId ); @Override Object[] getArguments(); @Deprecated void setArguments( Object[] arguments ); boolean isError(); @Override String getCopy(); void setCopy( String copy ); }
LogMessage implements LogMessageInterface { @Override public String getMessage() { String formatted = message; if ( arguments != null ) { final List<String> tokens = new ArrayList<>(); StringUtil.getUsedVariables( formatted, "{", "}", tokens, true ); for ( final String token : tokens ) { try { MessageFormat.format( "{" + token + "}", arguments ); } catch ( final IllegalArgumentException iar ) { formatted = formatted.replaceAll( "\\{" + token + "\\}", "\\'{'" + token + "\\'}'" ); } } formatted = MessageFormat.format( formatted, arguments ); } return formatted; } LogMessage( String subject, LogLevel level );  LogMessage( String message, String logChannelId, LogLevel level );  LogMessage( String message, String logChannelId, Object[] arguments, LogLevel level ); @Override @Deprecated String toString(); @Override LogLevel getLevel(); @Deprecated void setLevel( LogLevel level ); @Override String getMessage(); @Deprecated void setMessage( String message ); @Override String getSubject(); @Deprecated void setSubject( String subject ); @Override String getLogChannelId(); @Deprecated void setLogChannelId( String logChannelId ); @Override Object[] getArguments(); @Deprecated void setArguments( Object[] arguments ); boolean isError(); @Override String getCopy(); void setCopy( String copy );  }