日志写入

public static function addDomainLog($did, $conf, $info, $isChange) {
$basePath = C('UPLOADS_PATH') . DomainModel::DOMAIN_CONFIG_PATH_LOG;
if (!file_exists($basePath)) {
@mkdir($basePath, 0777, true);
}
$domainInfo = DomainRedisLogic::getInstance()->getBaseDomainInfoByDid($did);

$time = TimeHelper::formatTime();
$field = $isChange ? 'updateData' : 'originData';
$info = json_encode($info, JSON_UNESCAPED_SLASHES);
$content = "time:{$time} domain:{$domainInfo['name']} user_id:{$domainInfo['uid']} field:{$conf} {$field}:{$info}" . PHP_EOL;
file_put_contents("{$basePath}.domainLog.log", $content, FILE_APPEND | LOCK_EX);
}
posted @ 2021-06-25 10:38  代码堆里的看客  阅读(31)  评论(0编辑  收藏  举报