Example #1
0
 */
include "common.php";
use Sugi\Logger;
?>
<!doctype html>
<html lang="en">
<head>
	<title>Sugi Tests</title>
	<meta charset="utf-8" />
</head>
<body>
	<a href="index.php">back</a><br />

<?php 
Logger::stdout();
Logger::stdout(array('format' => '[{level}] [{Y}.{m}.{d} {H}:{i}:{s}] {message}<br />'));
$c = Logger::console();
Logger::loggly(array('filter' => 'all -debug', 'url' => 'localhost'));
$f = Logger::file(array('filename' => 'log/test.log', 'filter' => 'none +notice'));
Logger::log('some "debug" information', 'debug');
$c->message('this message have to be sholn only in console', 'notice');
Logger::log("somethin'\nwent WRONG!", 'notice');
$f->message('this is only for file, but it shall not be written', 'info');
?>

	<br />
	<a href="index.php">back</a>
	<br />
</body>
</html>
Example #2
0
File: Cron.php Project: rezon/sugi
 public static function error_handler($errno, $errstr, $errfile, $errline)
 {
     $errortype = array(E_ERROR => "Error", E_WARNING => "Warning", E_PARSE => "Parse Error", E_NOTICE => "Notice", E_CORE_ERROR => "Core Error", E_CORE_WARNING => "Core Warning", E_COMPILE_ERROR => "Compile Error", E_COMPILE_WARNING => "Compile Warning", E_USER_ERROR => "User Error", E_USER_WARNING => "User Warning", E_USER_NOTICE => "User Notice", E_STRICT => "Runtime Notice", E_RECOVERABLE_ERROR => "Catchable fatal error", E_DEPRECATED => "Deprecated Notice", E_USER_DEPRECATED => "User Dreprecated Notice");
     $current_job = static::$current_job;
     Logger::log("Cron job {$current_job} {$errortype[$errno]}: {$errstr} in {$errfile} line {$errline}", 'error');
     // Don't execute PHP internal error handler
     return true;
 }