Created
February 26, 2015 03:11
-
-
Save rongself/80374e87e91171fefe47 to your computer and use it in GitHub Desktop.
easy file log
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Created by PhpStorm. | |
* User: Ron | |
* Date: 14-12-30 | |
* Time: 下午5:57 | |
*/ | |
class Application_Model_SystemLog extends Zend_Log { | |
public function __construct($fileName,$subDirName='') | |
{ | |
$logDir = APPLICATION_PATH.'/../log/'; | |
$dir = $logDir.$subDirName.DIRECTORY_SEPARATOR; | |
if(!file_exists($logDir.$subDirName.DIRECTORY_SEPARATOR)){ | |
if(!@mkdir($logDir.$subDirName.DIRECTORY_SEPARATOR)){ | |
throw new Zend_Exception('Cannot create directory with path:'.$dir); | |
} | |
} | |
$writer = new Zend_Log_Writer_Stream($dir.date('Ymd').'-'.$fileName); | |
parent::__construct($writer); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment