wesnoth/data/core/macros/debug-utils.cfg

102 lines
2.7 KiB
INI

#textdomain wesnoth
# This file contains macros useful for debugging and testing purposes.
#define DEBUG_MSG MESSAGE_TEXT
# Emit a debug message. Meant to be overridden with no-op definition
# of the same name for production use.
[message]
speaker=narrator
message={MESSAGE_TEXT}
image=wesnoth-icon.png
[/message]
#enddef
#define DEBUG TEXT
# Logs a WML debug message to consol and the in-game chat.
# It does nothing unless the 'wml' log domain is set to debug
# level at application startup (usually with --log-debug=wml),
# or in-game with the :log command (e.g. :log debug wml).
#
# Example:
# ! {DEBUG "inconsistency: $unit.id is not loyal!"}
[wml_message]
logger=debug
message={TEXT}
[/wml_message]
#enddef
#define LOG TEXT
# Logs a WML message to console and the in-game chat. It does
# nothing unless the 'wml' log domain is set to log level at
# application startup (usually with --log-info=wml), or in-game
# with the :log command (e.g. :log info wml).
#
# Example:
# ! {LOG "player moved to forbidden location"}
[wml_message]
logger=log
message={TEXT}
[/wml_message]
#enddef
#define WARNING TEXT
# Logs a WML warning to console and the in-game chat. It does
# nothing unless the 'wml' log domain is set to warning level at
# application startup (usually with --log-warning=wml), or in-game
# with the :log command (e.g. :log warning wml).
#
# Example:
# ! {WARNING "malformed unit data"}
[wml_message]
logger=warn
message={TEXT}
[/wml_message]
#enddef
#define ERROR TEXT
# Logs a WML error to console and the in-game chat.
#
# Example:
# ! {ERROR "could not respawn hero at 2,4"}
[wml_message]
logger=err
message={TEXT}
[/wml_message]
#enddef
#define TIMED_ACTIONS TITLE_TEXT CONTENT_WML
# Measure (in milliseconds) the time arbitrary event WML takes to
# execute.
#
# Example:
#! [event]
#! name=start
#!
#! {TIME_ACTIONS "orc renaming" (
#! {MODIFY_UNIT race=orc name ( _ "Azir")}
#! )}
#! [/event]
[set_variable]
name=TIME_ACTIONS_time_begin
time=stamp
[/set_variable]
{CONTENT_WML}
[set_variable]
name=TIME_ACTIONS_time_end
time=stamp
[/set_variable]
[message]
speaker=narrator
caption={TITLE_TEXT}
message="$($TIME_ACTIONS_time_end - $TIME_ACTIONS_time_begin) milliseconds."
image=wesnoth-icon.png
[/message]
[clear_variable]
name=TIME_ACTIONS_time_begin,TIME_ACTIONS_time_end
[/clear_variable]
#enddef