log.error: Difference between revisions

From RPTools Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(4 intermediate revisions by 2 users not shown)
Line 7: Line 7:


|usage=
|usage=
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
log.error(message)
log.error(message)
</source>
</syntaxhighlight>
'''Parameters'''
'''Parameters'''
{{param|message|A string containing the message to be logged.}}
{{param|message|A string containing the message to be logged.}}
Line 16: Line 16:
Output a message to the {{code|macro-logger}} at the ERROR level.
Output a message to the {{code|macro-logger}} at the ERROR level.


<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
[h: log.error(getPlayerName() + " chose poorly")]
[h: log.error(getPlayerName() + " chose poorly")]
</source>
</syntaxhighlight>
'''Returns:'''
'''Returns:'''


Empty string to calling macro.  Output is to log file.
Empty string to calling macro.  Output is to log file.
<source lang="mtmacro" line>
<syntaxhighlight lang="mtmacro" line>
1989-05-24 08:13:32.911 [AWT-EventQueue-0] ERROR macro-logger - Bob chose poorly.
1989-05-24 08:13:32.911 [AWT-EventQueue-0] ERROR macro-logger - Bob chose poorly.
</source>
</syntaxhighlight>
|also=
|also=
[[log.getLoggers|log.getLoggers]] [[log.setLevel|log.setLevel]]
{{func|log.getLoggers}} {{func|log.setLevel}}


}}
}}
[[Category:Log Function]]
[[Category:Log Function]]

Latest revision as of 20:12, 15 March 2023

log.error() Function

 Note: This function can only be used in a Trusted Macro

Introduced in version 1.5.2
Writes a message to the log file at the ERROR logging level. Use log.setLevel() to set the appropriate level for the macro-logger.

Usage

log.error(message)

Parameters

  • message - A string containing the message to be logged.

Example

Output a message to the macro-logger at the ERROR level.
[h: log.error(getPlayerName() + " chose poorly")]

Returns:

Empty string to calling macro. Output is to log file.

1989-05-24 08:13:32.911 [AWT-EventQueue-0] ERROR macro-logger - Bob chose poorly.

See Also