mirror of
https://github.com/zhamao-robot/zhamao-framework.git
synced 2026-07-02 14:25:38 +08:00
add --audit-mode option
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -8,6 +8,9 @@
|
|||||||
/temp/
|
/temp/
|
||||||
/site/
|
/site/
|
||||||
|
|
||||||
|
# 框架审计文件
|
||||||
|
audit.log
|
||||||
|
|
||||||
# 进程锁文件
|
# 进程锁文件
|
||||||
.daemon_pid
|
.daemon_pid
|
||||||
.zm_worker_*.pid
|
.zm_worker_*.pid
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class RunServerCommand extends Command
|
|||||||
new InputOption('polling-watch', null, null, '强制启用轮询模式监听'),
|
new InputOption('polling-watch', null, null, '强制启用轮询模式监听'),
|
||||||
new InputOption('no-state-check', null, null, '关闭启动前框架运行状态检查'),
|
new InputOption('no-state-check', null, null, '关闭启动前框架运行状态检查'),
|
||||||
new InputOption('private-mode', null, null, '启动时隐藏MOTD和敏感信息'),
|
new InputOption('private-mode', null, null, '启动时隐藏MOTD和敏感信息'),
|
||||||
|
new InputOption('audit-mode', null, null, '启动时开启审计模式,独立将所有日志输出到文件供开发人员审计'),
|
||||||
]);
|
]);
|
||||||
$this->setDescription('Run zhamao-framework | 启动框架');
|
$this->setDescription('Run zhamao-framework | 启动框架');
|
||||||
$this->setHelp('直接运行可以启动');
|
$this->setHelp('直接运行可以启动');
|
||||||
|
|||||||
@@ -744,6 +744,17 @@ class Framework
|
|||||||
case 'log-debug':
|
case 'log-debug':
|
||||||
Console::setLevel(4);
|
Console::setLevel(4);
|
||||||
break;
|
break;
|
||||||
|
case 'audit-mode':
|
||||||
|
Console::warning('审计模式已开启,请正常执行需要审计的流程,然后Ctrl+C正常结束框架');
|
||||||
|
Console::warning('审计的日志文件将存放到:' . DataProvider::getWorkingDir() . '/audit.log');
|
||||||
|
if (file_exists(DataProvider::getWorkingDir() . '/audit.log')) {
|
||||||
|
unlink(DataProvider::getWorkingDir() . '/audit.log');
|
||||||
|
}
|
||||||
|
Console::info('框架将于5秒后开始启动...');
|
||||||
|
Console::setOutputFile(DataProvider::getWorkingDir() . '/audit.log');
|
||||||
|
Console::setLevel(4);
|
||||||
|
sleep(5);
|
||||||
|
break;
|
||||||
case 'log-theme':
|
case 'log-theme':
|
||||||
Console::$theme = $y;
|
Console::$theme = $y;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user