PageRenderTime 48ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/system/core/Log.php

https://bitbucket.org/localdisk/castalia
PHP | 44 lines | 16 code | 6 blank | 22 comment | 1 complexity | c6f27f17f4259c7f847fb72db31d060f MD5 | raw file
  1. <?php
  2. /**
  3. * Log
  4. *
  5. * PHP version 5
  6. *
  7. * @package Castalia
  8. * @category Log
  9. * @link http://bitbucket.org/localdisk/castalia
  10. * @author MATSUO Masaru
  11. * @copyright 2010 MATSUO Masaru
  12. * @license http://opensource.org/licenses/bsd-license.php New BSD License
  13. *
  14. */
  15. class Log {
  16. /**
  17. * Constructor
  18. */
  19. private function __construct() {
  20. }
  21. public static function getInstance() {
  22. return new self;
  23. }
  24. /**
  25. * write log
  26. *
  27. * @param string $text
  28. * @return void
  29. */
  30. public function write($text) {
  31. $dir = LOGPATH . date('Ymd') . DS;
  32. if (is_dir($dir) === FALSE) {
  33. mkdir($dir);
  34. }
  35. $file = $dir . date('Ymd') . '.log';
  36. file_put_contents($file, $text . "\n", FILE_APPEND);
  37. }
  38. }