primal / errorhandler
此包已被废弃,不再维护。未建议替代包。
快速触发类,用于内部处理所有错误和异常。默认以 JSON 数据格式输出
v1.0.0
2012-12-01 00:39 UTC
Requires
- php: >=5.3.10
This package is not auto-updated.
Last update: 2022-02-01 12:22:24 UTC
README
简单易用的类,用于捕获所有未捕获的错误进行处理。默认将错误以 JSON 格式输出,但可以通过自定义回调函数来覆盖此行为。旨在帮助构建 API 时的错误报告,但也适用于通用应用程序设置。处理异常、运行时错误和致命错误
##用法
//defaults to outputting errors as application/json
\Primal\ErrorHandler::Init();
//override with a custom callback to write to a log file
\Primal\ErrorHandler::Init(function ($error) {
error_log(json_encode($error), 0, '/path/to/error/log');
});