Changeset 297 in t29-www for lib/logging.php
- Timestamp:
- Sep 15, 2012, 7:32:28 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
lib/logging.php
r275 r297 1 1 <?php 2 /** 3 * t29Log is a very lightweight logging system for t29v6. 4 * 5 * The logging class is accessible via the Singleton pattern, but should 6 * be stored in a $GLOBAL["log"] and accessible like that everywhere. 7 * The contents are printed in t29Template. 8 * 9 * Inspired by Klooger for PHP: https://github.com/katzgrau/KLogger/ 10 **/ 2 11 3 /** 4 Inspired by Klooger, 5 https://github.com/katzgrau/KLogger/ 6 */ 12 7 13 class t29Log { 8 14 const EMERG = 'emerg'; // Emergency: system is unusable … … 32 38 public $entries = array(); 33 39 34 function __construct() { 40 // the one global t29Log instance 41 private static $instance; 42 43 // singleton access method 44 public function get() { 45 if(!isset(self::$instance)) 46 self::$instance = new t29Log; 47 return self::$instance; 48 } 49 50 private function __construct() { 35 51 // we shall be the PHP error handler 36 52 set_error_handler(array($this, 'log_phperror')); … … 86 102 } 87 103 88 104 public function INFO($line, $args = self::NO_ARGUMENTS){ 105 $this->log($line, self::INFO, $args); 106 } 107 108 public function DEBUG($line, $args = self::NO_ARGUMENTS){ 109 $this->log($line, self::INFO, $args); 110 } 89 111 90 112 } // class
Note: See TracChangeset
for help on using the changeset viewer.