Skip to content

LogMessage

virtual

SUPPRESSWARNINGS

Provides the ability to generate string messages on demand, using String.format()

Group Logger Engine

See Logger

See LogEntryEventBuilder

LogMessage(unformattedMessage, messageInput)

Section titled “LogMessage(unformattedMessage, messageInput)”

Constructor to handle dynamically formatting a string with 1 input

global LogMessage(String unformattedMessage, Object messageInput)
Name Type Description
unformattedMessage String The base string to use for your log message
messageInput Object The replacement text to use for 1 placeholder in the unformatted message

String formattedMessage = new LogMessage('Today is {0}', System.today()).getMessage();


LogMessage(unformattedMessage, messageInput1, messageInput2)

Section titled “LogMessage(unformattedMessage, messageInput1, messageInput2)”

Constructor to handle dynamically formatting a string with 2 inputs

global LogMessage(String unformattedMessage, Object messageInput1, Object messageInput2)
Name Type Description
unformattedMessage String The base string to use for your log message
messageInput1 Object The replacement text to use for the first placeholder in the unformatted message
messageInput2 Object The replacement text to use for the second placeholder in the unformatted message

String unformattedMessage = 'my string with 2 inputs: {0} and {1}'; String formattedMessage = new LogMessage(unformattedMessage, 'something', 'something else').getMessage();


LogMessage(unformattedMessage, messageInput1, messageInput2, messageInput3)

Section titled “LogMessage(unformattedMessage, messageInput1, messageInput2, messageInput3)”

SUPPRESSWARNINGS

Constructor to handle dynamically formatting a string with 3 inputs

global LogMessage(String unformattedMessage, Object messageInput1, Object messageInput2, Object messageInput3)
Name Type Description
unformattedMessage String The base string to use for your log message
messageInput1 Object The replacement text to use for the first placeholder in the unformatted message
messageInput2 Object The replacement text to use for the second placeholder in the unformatted message
messageInput3 Object The replacement text to use for the third placeholder in the unformatted message

String unformattedMessage = 'my string with 3 inputs: {0} and then {1} and finally {2}'; String formattedMessage = new LogMessage(unformattedMessage, 'something', 'something else', 'one more').getMessage();


LogMessage(unformattedMessage, messageInputs)

Section titled “LogMessage(unformattedMessage, messageInputs)”

Constructor to handle dynamically formatting a string with a list of inputs

global LogMessage(String unformattedMessage, List<Object> messageInputs)
Name Type Description
unformattedMessage String The base string to use for your log message
messageInputs List The list of inputs text to use for any placeholders in the unformatted message

String unformattedMessage = 'my string with 1 input: {0}'; List<Object> arguments = new List<Object>{ System.now() }; String formattedMessage = new LogMessage(unformattedMessage, arguments).getMessage();

Returns the formatted string to use as the log entry's message

global virtual String getMessage()

String

String