Skip to content
Snippets Groups Projects
Commit 367a4c7b authored by Tim Steiner's avatar Tim Steiner
Browse files

Add support for a logger in the index.php bootstrap.

parent 429968f3
No related branches found
No related tags found
No related merge requests found
......@@ -14,6 +14,7 @@ $autoloader->registerNamespace('Unl_');
$autoloader->pushAutoloader(new Unl_Loader_Autoloader());
$config = new Zend_Config_Ini(APPLICATION_DIR . '/config.ini');
Zend_Registry::set('config', $config);
$pearPath = $config->pear->include_path;
if ($pearPath) {
......@@ -45,7 +46,25 @@ $db->getProfiler()->setEnabled(true);
$scheduleDb = Zend_Db::factory($config->scheduleDb);
Zend_Registry::set('scheduleDb', $scheduleDb);
Zend_Registry::set('config', $config);
// Set up potential loggers.
$log = new Zend_Log();
$log->addWriter(new Zend_Log_Writer_Null());
if ($config->log instanceof Zend_Config) {
if ($config->log->stream) {
$log->addWriter(new Zend_Log_Writer_Stream($config->log->stream));
}
if ($config->log->firebug) {
echo 'yes' . PHP_EOL;
$log->addWriter(new Zend_Log_Writer_Firebug());
}
if ($config->log->syslog instanceof Zend_Config) {
print_r($config->log->syslog);
$log->addWriter(new Zend_Log_Writer_Syslog($config->log->syslog->toArray()));
}
}
$log->log('nope', Zend_Log::WARN);
Zend_Registry::set('log', $log);
Zend_Layout::startMvc();
$layout = Zend_Layout::getMvcInstance();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment