/system/core/Log.php
PHP | 44 lines | 16 code | 6 blank | 22 comment | 1 complexity | c6f27f17f4259c7f847fb72db31d060f MD5 | raw file
- <?php
- /**
- * Log
- *
- * PHP version 5
- *
- * @package Castalia
- * @category Log
- * @link http://bitbucket.org/localdisk/castalia
- * @author MATSUO Masaru
- * @copyright 2010 MATSUO Masaru
- * @license http://opensource.org/licenses/bsd-license.php New BSD License
- *
- */
- class Log {
- /**
- * Constructor
- */
- private function __construct() {
- }
- public static function getInstance() {
- return new self;
- }
- /**
- * write log
- *
- * @param string $text
- * @return void
- */
- public function write($text) {
- $dir = LOGPATH . date('Ymd') . DS;
- if (is_dir($dir) === FALSE) {
- mkdir($dir);
- }
- $file = $dir . date('Ymd') . '.log';
- file_put_contents($file, $text . "\n", FILE_APPEND);
- }
- }