Difference between revisions of "Debug"
From LongJump Support Wiki
imported>Aeric |
imported>Aeric |
||
(7 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:debug}} | {{DISPLAYTITLE:debug}} | ||
{{Deprecated|<br>This function has been deprecated. Developers are encouraged to use the Logger utility class, instead.<br>''Learn more:'' [[Debug Log]].}} | |||
Logs a debug message at the "INFO" severity level. | |||
''Learn more:'' | |||
:* View debug messages in the [[Debug Log]] | |||
:* Change the recording level for messages in [[Developer Configuration]] | |||
;Parameters: | ;Parameters: | ||
:<tt>obj</tt> - An object or a String. | :<tt>obj</tt> - An object or a String. | ||
'''Syntax''' | '''Syntax''' | ||
: | :<syntaxhighlight lang="java" enclose="div"> | ||
< | void = Functions.debug(Object obj); | ||
void = Functions.debug(String message); | |||
</syntaxhighlight> | |||
'''Return''' | '''Return''' | ||
Line 18: | Line 21: | ||
;Example:This example calls <tt>debug</tt> after calling <tt>updateRecord</tt> to log the result code. The code also calls <tt>debug</tt> to log the message if the result code is less than zero (0). | ;Example:This example calls <tt>debug</tt> after calling <tt>updateRecord</tt> to log the result code. The code also calls <tt>debug</tt> to log the message if the result code is less than zero (0). | ||
: | :<syntaxhighlight lang="java" enclose="div"> | ||
<syntaxhighlight lang="java" enclose="div"> | |||
Parameters params = Functions.getParametersInstance(); | Parameters params = Functions.getParametersInstance(); | ||
String accountID = ""; | String accountID = ""; | ||
Line 32: | Line 33: | ||
int resultCode = result.getCode(); | int resultCode = result.getCode(); | ||
Functions.debug(" Result code is " + resultCode); | Functions.debug(" Result code is " + resultCode); | ||
if(resultCode < 0) | if(resultCode < 0) | ||
{ | { | ||
// Some error happened. | // Some error happened. | ||
String msg = "Account could not be updated"; | String msg = "Account could not be updated"; | ||
Line 46: | Line 44: | ||
else | else | ||
{ | { | ||
// Take other actions on successful addition | // Take other actions on successful addition of the account. | ||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> | ||
<noinclude> | <noinclude> | ||
[[Category:Utility]] | [[Category:Utility]] | ||
</noinclude> | </noinclude> |
Latest revision as of 00:33, 9 February 2012
DEPRECATED:
This function has been deprecated. Developers are encouraged to use the Logger utility class, instead.
Learn more: Debug Log.
Logs a debug message at the "INFO" severity level.
Learn more:
- View debug messages in the Debug Log
- Change the recording level for messages in Developer Configuration
- Parameters
- obj - An object or a String.
Syntax
void = Functions.debug(Object obj); void = Functions.debug(String message);
Return None
- Example
- This example calls debug after calling updateRecord to log the result code. The code also calls debug to log the message if the result code is less than zero (0).
Parameters params = Functions.getParametersInstance(); String accountID = ""; // Some logic to populate accountID variable. params.add("name", "Acme Solutions"); params.add("number", "GRG2323339"); Result result = Functions.updateRecord("ACCOUNT", accountID, params); int resultCode = result.getCode(); Functions.debug(" Result code is " + resultCode); if(resultCode < 0) { // Some error happened. String msg = "Account could not be updated"; Functions.debug(msg + ":\n" + result.getMessage()); // Log details Functions.throwError(msg + "."); // Error dialog } else { // Take other actions on successful addition of the account. }