minor
defect
major
minor
minor
#29089
Extend the TL Script functions log() and info() to include selectable message levels (INFO, WARN, ERROR)
The TL-Script functions log() (writes an entry to the application log) and info() (displays a message in the user interface) can currently generate only INFO-level messages.
However, depending on the situation, warnings and errors may also need to be logged or displayed to the user. Without this capability, validation or processing issues, for example, cannot be reported from within a script with the appropriate level of urgency.
Therefore, both functions are being provided with an additional, optional parameter that can be used to specify the message level. This enhancement is migration-free: existing calls will behave as before (INFO level).
Implementation
- New optional parameter ` level ` (string; case-insensitive).
- log() supports the levels debug, info, warn, error, and fatal, and writes to the application log at the corresponding log level.
- info() supports the levels info, warn, and error (debug is displayed as info, fatal as error) and displays the message with the appropriate formatting.
- Since `log() ` accepts any number of format arguments, the level is passed there exclusively as a named parameter:
{{{#!java log('Storage almost full: {0}%', $percent, level: 'warn') }}}
- With ` info()`, the level can be specified as the third (positional) parameter or as a named parameter:
{{{#!java info('Import completed', 'With 3 warnings', 'warn') }}}
Consolidates #27788.