LOGGER()
All functions > METADATA > LOGGER()
Logs the calls of a prepared statement to a sink, row by row, after each response is sent.
Signatures
Returns: A logger the serving engine runs on every call of the statement
LOGGER( ON prepared_statement [ WHERE condition ] [ EXCLUDE ( column, ... ) ] TO sink ) column: feature [ [field] ... ] → LOGGER
| Parameter | Type | Required | Description |
|---|---|---|---|
prepared_statement | FEATURE | Yes | A PREPARED_STATEMENT feature: its inputs, its output and its CAPTURE features are logged |
sink | SINK | Yes | Where the rows go: a SINK feature, or SINK('<dsn>') inline. Cold sinks only (files, object stores, stdout://): Redis, Postgres and MySQL are refused |
column | FEATURE | Yes | An input, the output, a captured feature, or a field path of a ROW one (SCORE[embedding]), left out of the log |
condition | BOOLEAN | Yes | Keeps a row when TRUE; reads only the statement's inputs, output and captures. Failed calls are always logged |
Notes
- Each row holds
CALL_ID,CALL_INDEX,CALL_TIME,CALL_DETAILS, then the statement's inputs, output and captures INCLUDEandCOLUMNSare refused: log more features withCAPTURE (...)in the prepared statement- A logger never changes its statement: it runs after the response, on the call's own row
ON,WHERE,EXCLUDEandTOcome in this order;LOGGER(statement TO sink ...)is refused- A logger writes cold sinks only (files, object stores,
stdout://):TOa Redis, PostgreSQL or MySQL sink is refused
See also
Examples
Log half the calls of a prepared statement, without the model name
FeatureQL
CREATE OR REPLACE FEATURE FM.TUTORIALS.LOGGING.SCORE_LOGGER AS
LOGGER(
ON FM.TUTORIALS.LOGGING.SCORE_PS
WHERE HASH01('log/' || FM.TUTORIALS.LOGGING.USER_ID::VARCHAR) <.6 0.5
EXCLUDE (FM.TUTORIALS.LOGGING.SCORE[model])
TO FM.TUTORIALS.LOGGING.ML_LOGS
);Result
| feature_name VARCHAR | status VARCHAR | message VARCHAR |
|---|---|---|
| FM.TUTORIALS.LOGGING.SCORE_LOGGER | CREATED | Feature created as not exists |