public function init()
{
parent::init();
$this->debug_log = session_id() ? $this->recall('debug_log', '') : '';
if (session_id()) {
$this->forget('debug_log');
}
$this->debug_log .= '[<font color=red>Debug log from ' . date('d.m.Y H:m:s') . ' to ' . $_SERVER['QUERY_STRING'] . "</font>] - debug started<br>\n";
$this->debug_added = false;
register_shutdown_function(array($this, 'showDebugInfo'));
$this->log_output = $this->app->getConfig('logger/log_output', null);
$this->web_output = $this->app->getConfig('logger/web_output', 'full');
if (!$this->web_output) {
$this->public_error_message = $this->app->getConfig('debug_public_error_message', 'We were unable to deal with your request. Please retry later.');
}
$this->log_dir = $this->app->getConfig('logger/log_dir', '/var/log/atk4/' . $this->app->name);
if ($this->log_output) {
$this->openLogFile('error');
$this->openLogFile('debug');
$this->openLogFile('info');
if (rand(1, 50) == 1) {
$this->cleanupLogDirectory();
}
}
if ($this->log_output == 'full' || $this->web_output == 'full') {
// Full logging will require some preparations
$this->gatherDetails();
}
if ($this->app instanceof App_Web) {
$this->html_stdout = true;
}
$this->app->addHook('caught-exception', array($this, 'caughtException'));
$this->app->addHook('output-fatal', array($this, 'outputFatal'));
$this->app->addHook('output-warning', array($this, 'outputWarning'));
$this->app->addHook('output-info', array($this, 'outputInfo'));
$this->app->addHook('output-debug', array($this, 'outputDebug'));
$this->app->debug('Logger is initialized');
}