library log
Modulo de logs para Zend Framework 3
zf-metal/log
Modulo de logs para Zend Framework 3
- Sunday, February 25, 2018
- by cincarnato
- Repository
- 2 Watchers
- 0 Stars
- 141 Installations
- PHP
- 3 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 4 Versions
- 9 % Grown
Dependencies
- zendframework/zend-log
- zf-metal/commons
Default path
proyectPath/logs, (*1)
Config
Add a file config (ex: zfmetal-log.global.php) in config/autoload., (*2)
$date = new \DateTime();
return[
'zf-metal-log.options' => [
'log_file' => './logs/' . $date->format('Y-m-d') . '.log',
'filter' => \Zend\Log\Logger::INFO,
]
];
Service Manager
$container->get('zf-metal.log');
, (*3)
OR, (*4)
$container->get(\ZfMetal\Log\Log::class);
, (*5)
Plugin Controller
$this->logger()
, (*6)
Facade
Logger::method();
, (*7)
Hot to use
$this->logger()->emerg($message);
$this->logger()->alert($message);
$this->logger()->crit($message);
$this->logger()->err($message);
$this->logger()->warn($message);
$this->logger()->notice($message);
$this->logger()->info($message);
$this->logger()->debug($message);
By Facade, (*8)
Logger::emerg($message);
Logger::alert($message);
Logger::crit($message);
Logger::err($message);
Logger::warn($message);
Logger::notice($message);
Logger::info($message);
Logger::debug($message);
Log Exception (Message, File, Line, Trace )
-
$this->logger()->exception($exception);
, (*9)
-
Logger::exception($exception);
, (*10)