254863e1e4dc252ccd971245347c24789357bb1d.svn-base
990 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
if(! class_exists("LogUtil") ) {
class LogUtil
{
private static function writeLog($logPath, $logData)
{
$logTime = date("Y-m-d H:i:s", time());
$fp = fopen($logPath,"a+");
//파일에 쓰는부분 .
fwrite($fp,"log Date : ".$logTime. " // " . $logData . "\n");
fwrite($fp,"============================================================================\n");
//파일 쓰기 끝 닫기
fclose($fp);
}
private static function makeLogFolder($fileDirectory)
{
if(!is_dir ($fileDirectory)){
mkdir($fileDirectory, 0755, true);
}
}
public static function writeFileLog($basePath, $logData, $foldor = "simpleLog")
{
$today = date("Ymd", time());
$month = date('Ym', time());
$folderPath = $basePath . "/" . $foldor . "/" . $month ;
$fileName = $today.".txt";
$logPath = $folderPath."/".$fileName;
//폴더 생성
self::makeLogFolder($folderPath);
self::writeLog($logPath, $logData);
}
}
}
?>