Location: PHPKode > projects > PhpBlock > A9.8/script/log.class.php
<?php
class Log {
    private static $instance;

    public static $ALL = 0;
    public static $DEBUG = 20;
    public static $INFO = 40;
    public static $WARN = 80;
    public static $ERROR = 100;

    private function __construct() {
        $this->isDebugOn = False;
        $this->debugNewLine = "<br>\n";
        $this->logLevel = Log::$ALL;
    }
    
    public static function getInstance() {
        if(!Log::$instance) {
            Log::$instance = new Log();
        }
        return Log::$instance;
    }
    
    public static function isDebugOn(){
        return Log::getInstance()->isDebugOn;
    }
    
    public static function debug($par1) {
        if(Log::getInstance()->isDebugOn()) {
            Log::getInstance()->log(Log::$DEBUG, "DEBUG: $par1");
        }
    }
    
    public static function info($par1, $parIsLn=true) {
        Log::getInstance()->log(Log::$INFO, "INFO : $par1", $parIsLn);
    }
    public static function warn($par1) {
        Log::getInstance()->log(Log::$WARN, "WARN : $par1");
    }
    public static function error($par1) {
        Log::getInstance()->log(Log::$ERROR, "ERROR: $par1");
    }
    public function log($parLevel, $par1, $parIsLn=true) {
        if($parLevel >= $this->logLevel) {
            echo "$par1".($parIsLn?$this->debugNewLine:"");
        }
    }
}
?>
Return current item: PhpBlock