[actions] support multiple actions per pattern

This commit is contained in:
Mike Fährmann
2024-06-30 02:06:09 +02:00
parent 8219a78b8d
commit f41a5065b2
2 changed files with 38 additions and 11 deletions

View File

@@ -936,23 +936,31 @@ Description
extractor.*.actions
-------------------
Type
* ``object`` (`pattern` -> `action`)
* ``list`` of ``lists`` with 2 ``strings`` as elements
* ``object`` (`pattern` -> `action(s)`)
* ``list`` of ``lists`` with `pattern` -> `action(s)` pairs as elements
Example
.. code:: json
{
"error" : "status |= 1",
"info:Logging in as .+" : "level = debug",
"warning:(?i)unable to .+": "exit 127",
"info:Logging in as .+" : "level = debug"
"error" : [
"status |= 1",
"exec notify.sh 'gdl error'",
"abort"
]
}
.. code:: json
[
["error" , "status |= 1" ],
["info:Logging in as .+" , "level = debug"],
["warning:(?i)unable to .+", "exit 127" ],
["info:Logging in as .+" , "level = debug"]
["error" , [
"status |= 1",
"exec notify.sh 'gdl error'",
"abort"
]]
]
Description
@@ -968,6 +976,9 @@ Description
``action`` is parsed as action type
followed by (optional) arguments.
It is possible to specify more than one ``action`` per ``pattern``
by providing them as a ``list``: ``["<action1>", "<action2>", …]``
Supported Action Types:
``status``:
@@ -982,9 +993,9 @@ Description
``level``:
| Modify severity level of the current logging message.
| Can be one of ``debug``, ``info``, ``warning``, ``error`` or an integer value.
``print``
``print``:
Write argument to stdout.
``exec``
``exec``:
Run a shell command.
``abort``:
Stop the current extractor run.
@@ -993,7 +1004,8 @@ Description
``restart``:
Restart the current extractor run.
``wait``:
Stop execution until Enter is pressed.
| Sleep for a given Duration_ or
| wait until Enter is pressed when no argument was given.
``exit``:
Exit the program with the given argument as exit status.