Open GoogleCodeExporter opened 9 years ago
This could work fine with PEAR Log class, if the extra $ident wasn't there.
require_once 'Log.php';
require_once 'Minify/Logger.php';
$log = Log::singleton('error_log', PEAR_LOG_TYPE_SYSTEM, 'minify');
Minify_Logger::setLogger($log);
it basically works, but throws warning to errorlog:
2012-03-29 22:26:41: (mod_fastcgi.c.2699) FastCGI-stderr: PHP Notice:
Undefined index: Minify in /usr/share/pear/Log.php on line 591
minify: A group configuration for "f" was not found
i.e the $label Minify would be expected by pear logger as priority:
public static function log($msg, $label = 'Minify') {
if (! self::$_logger) return;
self::$_logger->log($msg, $label);
}
Original comment by elan.ruu...@gmail.com
on 29 Mar 2012 at 7:31
such simple class could do it with Pear logger:
/**
* @author Elan Ruusamäe <glen@delfi.ee>
*/
class Logger {
private $logger;
public function __construct($ident) {
$this->logger = Log::singleton('error_log', PEAR_LOG_TYPE_SYSTEM, $ident);
}
/**
* Pass a message to the logger (if set)
*
* @param string $msg message to log
* @return null
*/
public function log($msg, $label = 'Minify') {
$this->logger->log($msg);
}
}
$log = new Logger('Minify');
Minify_Logger::setLogger($log);
Original comment by elan.ruu...@gmail.com
on 29 Mar 2012 at 7:40
The plan is to replace Minify_Logger with an interface, and pass the logger
directly into Minify::serve() and have it pass it on to the cache, etc. The aim
is to remove all the statics eventually.
Original comment by mrclay....@gmail.com
on 29 Mar 2012 at 8:12
Original issue reported on code.google.com by
mrclay....@gmail.com
on 20 Jan 2011 at 8:07