emit_log_hook
服务器日志输出
在消息写入服务器日志之前拦截消息的钩子。
当前查看 PostgreSQL 18。
中文定义与说明
在消息写入服务器日志之前拦截消息的钩子。
以下中文为本站依据所列 PostgreSQL 源码注释编译的说明。
接口声明
typedef void (*emit_log_hook_type) (ErrorData *edata); extern PGDLLIMPORT emit_log_hook_type emit_log_hook;
源码说明
在消息写入服务器日志之前拦截消息。被 log_min_messages 抑制的消息不会调用此钩子;预加载库中的日志钩子也无法捕获该库加载之前产生的日志消息。
调用位置
src/backend/utils/error/elog.c:1729
核心调用上下文:src/backend/utils/error/elog.c:1723–1737
* The log hook has access to both the translated and original English * error message text, which is passed through to allow it to be used as a * message identifier. Note that the original text is not available for * detail, detail_log, hint and context text elements. */ if (edata->output_to_server && emit_log_hook) (*emit_log_hook) (edata); /* Send to server log, if enabled */ if (edata->output_to_server) send_message_to_server_log(edata); /* Send to client, if enabled */ if (edata->output_to_client) send_message_to_frontend(edata);
说明
在消息写入服务器日志之前拦截消息的钩子。
- 接口类型
- emit_log_hook_type
- 声明头文件
- src/include/utils/elog.h
- 调用阶段
- 日志与函数调用
- 初始值
- NULL(未安装钩子)
接口签名
typedef void (*emit_log_hook_type) (ErrorData *edata);
extern PGDLLIMPORT emit_log_hook_type emit_log_hook;调用位置
src/backend/utils/error/elog.c:1729
文档与源码
查看来源构建
- 版本
- 18
- 构建
- REL_18_STABLE
- 来源指纹
753057e340da8f22e57c9a409ea7a235fd6a46bd
同类条目
fmgr_hook函数调用事件needs_fmgr_hook函数调用追踪筛选
返回扩展钩子 · 此条目的收录范围为 PostgreSQL 10 至 20;起点不一定是实际引入版本。