public function initialization()
{
$this->registerDi();
$this->container->get('logger')->info("Logger initialization", []);
$this->container->get('logger')->info("Request Url", [$_SERVER['REQUEST_URI']]);
$this->container->get('logger')->info("Request Method", [$_SERVER['REQUEST_METHOD']]);
$this->container->dispatcher->addListener('module.modules.beforeAllInitialization', function () {
$arModules = $this->container->modules->keys();
foreach ($arModules as $name) {
$this->container->dispatcher->addListener('module.' . $name . '.beforeInitialization', function ($event) use($name) {
$event->getLogger()->info("action beforeInitialization", [$name]);
//$event->getParam()->getName()
});
$this->container->dispatcher->addListener('module.' . $name . '.afterInitialization', function ($event) use($name) {
$event->getLogger()->info("action afterInitialization", [$name]);
});
}
});
$this->container->dispatcher->addListener('app.afterRun', function ($event) {
$workTime = round(microtime(true) - $GLOBALS['startTime'], 3);
$logger = $event->getLogger();
$logger->stat("work time: ", [$workTime . 's']);
$logger->stat("memory usage: ", [memoryFormat(memory_get_usage())]);
$logger->stat("max memory usage: ", [memoryFormat(memory_get_peak_usage())]);
$logger->stat("Stop Application", []);
});
}