类别:

系统函数 (系统信息)

SYSTEM$LOG、SYSTEM$LOG_<level> (适用于 Snowflake Scripting)

以指定的严重性级别记录消息。

语法

SYSTEM$LOG('<level>', <message>);

SYSTEM$LOG_TRACE(<message>);
SYSTEM$LOG_DEBUG(<message>);
SYSTEM$LOG_INFO(<message>);
SYSTEM$LOG_WARN(<message>);
SYSTEM$LOG_ERROR(<message>);
SYSTEM$LOG_FATAL(<message>);
Copy

实参

'level'

记录消息的严重性级别。您可以指定以下其中一种字符串:

  • 'trace'

  • 'debug'

  • 'info'

  • 'warn'

  • 'error'

  • 'fatal'

message

解析为要记录的消息的表达式。如果消息不是字符串,则该函数会将消息转换为字符串。

示例

以下示例中的代码使用 SYSTEM$LOG 函数在每个受支持级别记录消息。请注意,系统将针对处理程序处理的 每一行 记录通过处理输入行的代码记录的消息。如果在大型表中执行处理程序,则可能会导致事件表中出现大量消息。

-- The following calls are equivalent.
-- Both log information-level messages.
SYSTEM$LOG('info', 'Information-level message');
SYSTEM$LOG_INFO('Information-level message');

-- The following calls are equivalent.
-- Both log error messages.
SYSTEM$LOG('error', 'Error message');
SYSTEM$LOG_ERROR('Error message');


-- The following calls are equivalent.
-- Both log warning messages.
SYSTEM$LOG('warning', 'Warning message');
SYSTEM$LOG_WARN('Warning message');

-- The following calls are equivalent.
-- Both log debug messages.
SYSTEM$LOG('debug', 'Debug message');
SYSTEM$LOG_DEBUG('Debug message');

-- The following calls are equivalent.
-- Both log trace messages.
SYSTEM$LOG('trace', 'Trace message');
SYSTEM$LOG_TRACE('Trace message');

-- The following calls are equivalent.
-- Both log fatal messages.
SYSTEM$LOG('fatal', 'Fatal message');
SYSTEM$LOG_FATAL('Fatal message');
Copy
语言: 中文