choate / yii-log
Yii2 extension log
Installs: 4
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Type:libaray
Requires
- php: >=5.5.0
- yiisoft/yii2: >=2.0.6
This package is auto-updated.
Last update: 2025-03-11 00:40:49 UTC
README
扩展日志格式
支持格式
- json
安装
基于composer安装
php composer.phar require choate/yii-log
使用
'log' => [ 'targets' => [ 'trace' => [ 'class' => 'choate\yii\log\JsonFileTarget', 'levels' => 79, 'logFile' => '@runtime/logs/console.log', ], ], ],
Targets
JsonFileTarget
配置说明
logTag
日志唯一标识符,用于追踪一个请求所产生的日志
输出日志说明
{
ip: "-", // 请求IP
user_id: "-", // 请求用户
session_id: "-", // 请求用户SESSION ID
request_id: "59252e208c8ac", // 请求唯一标识符用于追踪日志
application: "default", // 请求应用
route: "default/index", // 请求路由
status_code: 0, // 响应状态码
request_time: "2017-05-24 14:54:24", // 请求时间
start_time: 1495608864.568761,
end_time: 1495608864.576908,
duration: "8 ms", // 请求耗时
SERVER: {}, // PHP $_SERVER
COOKIE: {}, // PHP $_COOKIE
POST: {}, // PHP $_POST
GET: {}, // PHP $_GET
FILES: {}, // PHP $_FILES
operation: { // 请求操作路由日志
0: {
level: "info",
category: "application",
timestamp: "2017-05-24 14:54:24",
text: "成功",
traces: [ ]
},
1: {
level: "info",
category: "application",
timestamp: "2017-05-24 14:54:24",
text: "成功",
traces: [ ]
}
}
}