public function __construct($config)
 {
     $this->_config = (require_once $config);
     Service::setConfig($this->_config);
     if ($this->_config['mode'] !== 'dev') {
         error_reporting(0);
         ini_set('display_errors', '0');
     }
     $logger = new Logger($this->_config['log']);
     Service::set('logger', $logger->getLogger());
     $this->_initComponents();
     new Connection($this->_config['pdo']);
     Service::set('db', Connection::getDb());
     Service::set('session', new Session());
     $securityConf = Service::getConfig('security');
     $securityClass = $securityConf['user_class'];
     Service::set('security', new $securityClass());
     Service::set('router', new Router($this->_config['routes']));
     Service::set('request', new Request());
     Service::set('app', $this);
 }
 public function log($message, $level = 'NOTICE')
 {
     $datetime = '[' . @date("d-m-Y H:i:s") . ']';
     $queryTime = '[qt:' . round(Logger::getScriptTime(), 4) . ']:';
     if (!file_exists($this->_logFile)) {
         file_put_contents($this->_logFile, $this->getLogo());
     }
     $backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
     $line = $backtrace[1]['line'];
     $file = $backtrace[1]['file'];
     $type = $backtrace[1]['type'];
     $func = $backtrace[1]['function'];
     $fopen = fopen($this->_logFile, 'a');
     fwrite($fopen, $datetime . $queryTime . self::NEWLINE . '[' . $level . ']' . $file . ' in line ' . $line . ', function: ' . @$type . @$func . '()' . self::NEWLINE . '[MESSAGE]' . $message . self::NEWLINE . '----------------------------------------------------' . self::NEWLINE);
     fclose($fopen);
 }