app/library/Services.php: Update logging initialization
This commit is contained in:
parent
771cb05b12
commit
62550f90fa
1 changed files with 5 additions and 4 deletions
|
|
@ -17,7 +17,6 @@ use Phalcon\Di\FactoryDefault as DiDefault,
|
||||||
Phalcon\Cache\Backend\Apc as BackendApcCache,
|
Phalcon\Cache\Backend\Apc as BackendApcCache,
|
||||||
Phalcon\Translate\Adapter\NativeArray as TranslateAdapter,
|
Phalcon\Translate\Adapter\NativeArray as TranslateAdapter,
|
||||||
Phalcon\Logger,
|
Phalcon\Logger,
|
||||||
Phalcon\Logger\Adapter\File as FileLogAdapter,
|
|
||||||
Phalcon\Mvc\Router;
|
Phalcon\Mvc\Router;
|
||||||
|
|
||||||
use Httpcb\Auth,
|
use Httpcb\Auth,
|
||||||
|
|
@ -154,7 +153,7 @@ class Services extends DiDefault
|
||||||
$eventsManager->attach('db', function ($event, $connection) use ($logger) {
|
$eventsManager->attach('db', function ($event, $connection) use ($logger) {
|
||||||
|
|
||||||
if ($event->getType() == 'beforeQuery') {
|
if ($event->getType() == 'beforeQuery') {
|
||||||
$logger->log($connection->getRealSQLStatement(), Logger::INFO);
|
$logger->info($connection->getRealSQLStatement());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -354,8 +353,10 @@ class Services extends DiDefault
|
||||||
|
|
||||||
protected function _initSharedLogger()
|
protected function _initSharedLogger()
|
||||||
{
|
{
|
||||||
$path = $this->get('config')->application->logDir;
|
$path = $this->get('config')->application->logDir;
|
||||||
return new FileLogAdapter($path . "app.txt");
|
return new \Phalcon\Logger('default', [
|
||||||
|
'main' => new \Phalcon\Logger\Adapter\Stream($path . 'app.txt')
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function _initTemplate()
|
protected function _initTemplate()
|
||||||
|
|
|
||||||
Reference in a new issue