4 Star 10 Fork 2

若相惜_莫回首 / php-webhook

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
log.class.php 1.22 KB
一键复制 编辑 原始数据 按行查看 历史
mohuishou 提交于 2016-04-28 15:48 . init
<?php
/**
* 日志类
* Created by mohuishou<1@lailin.xyz>.
* User: mohuishou<1@lailin.xyz>
* Date: 2016/4/27 0027
* Time: 14:06
*/
date_default_timezone_set('Asia/Chongqing');
class Log{
public static function newLog($project_name,$content=null,$file_name=null){
$now=date('Y-m');
if($file_name==null) $file_name=$now;
$path="./log/success/$project_name/$file_name.log";
if(!is_dir(dirname($path))){
mkdir(dirname($path), 0777,true); //目录不存在创建目录
}
$file = fopen($path, "a");
$now_time=date('Y-m-d H:m:s');
if($content==null) $content="【 $now_time 】:$project_name 拉取成功 \r\n";
fwrite($file, $content);
fclose($file);
}
public static function errorLog($project_name,$content,$file_name=null){
$now=date('Y-m');
if($file_name==null) $file_name=$now;
$path="./log/error/$project_name/$file_name.log";
if(!is_dir(dirname($path))){
mkdir(dirname($path), 0777,true); //目录不存在创建目录
}
$file = fopen($path, "a");
$now_time=date('Y-m-d H:m:s');
fwrite($file,"【 $now_time 】:" . $content);
fclose($file);
}
}
PHP
1
https://gitee.com/lxl520/php-webhook.git
git@gitee.com:lxl520/php-webhook.git
lxl520
php-webhook
php-webhook
master

搜索帮助

53164aa7 5694891 3bd8fe86 5694891