first commit
This commit is contained in:
22
plugins/cvIngPlugin.bck/lib/cvIngLog.class.php
Normal file
22
plugins/cvIngPlugin.bck/lib/cvIngLog.class.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
class cvIngLog{
|
||||
public static function getLogPath() {
|
||||
return sfConfig::get('sf_log_dir') . DIRECTORY_SEPARATOR . "cvIngPlugin.log";
|
||||
}
|
||||
|
||||
public static function add($sth) {
|
||||
if(stConfig::getInstance('cvIngBackend')->get('log_enabled')){
|
||||
$file = fopen(self::getLogPath(), "a");
|
||||
$sth = is_array($sth) || is_object($sth) ? print_r($sth, 1) : $sth;
|
||||
fwrite($file, PHP_EOL . date("Y:m:d H:i:s") . " ==> " . $sth);
|
||||
fclose($file);
|
||||
}
|
||||
}
|
||||
|
||||
public static function clearLog() {
|
||||
if (file_exists(self::getLogPath())) {
|
||||
unlink($this->logFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user