src/Module/Logger/CalgamoLoggerModule.php
public function install(ApplicationInterface $app)
    {
        try{
            $event_channel = $app->eventstream()->channel(Channels::SYSTEM);
            $fs = $app->fileSystem();
            $config_file = $fs->getFile('config', ConfigFiles::LOGGER);

            if (!file_exists($config_file) || !is_readable($config_file)){
                throw new ModuleInstallationException(self::class, 'Config file does not exist or no readable: ' . $config_file);
            }

            /** @noinspection PhpIncludeInspection */
            $config = require_once $config_file;

            $log_manager = new LogManager($config['log_manager'] ?? []);
            $app_logger =  new CalgamoLoggerAdapter($log_manager);
            $app->logger($app_logger);

            $event_channel->push(Events::LOGGER_ATTACHED, $app_logger);

            $logs_config = $config['logs'] ?? [];
            foreach($logs_config as $name => $config)
            {
                $type = $config['type'] ?? null;
                $options = $config['options'] ?? [];
                $logger = null;
                switch($type)
                {
                    case 'file':
                        $logger = new FileLogger($options, function($keyword) use($fs){
                            switch($keyword){
                                case 'LOGS_DIR':
                                    return $fs->getDirectory('logs');
                            }
                            return null;
                        });
                        break;

                    case 'console':
                        $logger = new ConsoleLogger($options);
                        break;

                    default:
                        $reason = "Invalid logger type($type) for {$name} specified in log config file: $config_file";
                        throw new ModuleInstallationException(self::class, $reason);
                        break;
                }
                $log_manager->register($name, $logger);

                $event_channel->push(Events::LOGGER_CHANNEL_CREATED, [
                        'name' => $name,
                        'logger' => $logger,
                    ]);
            }
        }
        catch(EventStreamException $e)
        {
            throw new ModuleInstallationException(self::class, $e->getMessage(), $e);
        }
    }
public function install(ApplicationInterface $app)
    {
        try{
            $event_channel = $app->eventstream()->channel(Channels::SYSTEM);
            $fs = $app->fileSystem();
            $config_file = $fs->getFile('config', ConfigFiles::LOGGER);

            if (!file_exists($config_file) || !is_readable($config_file)){
                throw new ModuleInstallationException(self::class, 'Config file does not exist or no readable: ' . $config_file);
            }

            /** @noinspection PhpIncludeInspection */
            $config = require_once $config_file;

            $log_manager = new LogManager($config['log_manager'] ?? []);
            $app_logger =  new CalgamoLoggerAdapter($log_manager);
            $app->logger($app_logger);

            $event_channel->push(Events::LOGGER_ATTACHED, $app_logger);

            $logs_config = $config['logs'] ?? [];
            foreach($logs_config as $name => $config)
            {
                $type = $config['type'] ?? null;
                $options = $config['options'] ?? [];
                $logger = null;
                switch($type)
                {
                    case 'file':
                        $logger = new FileLogger($options, function($keyword) use($fs){
                            switch($keyword){
                                case 'LOGS_DIR':
                                    return $fs->getDirectory('logs');
                            }
                            return null;
                        });
                        break;

                    case 'console':
                        $logger = new ConsoleLogger($options);
                        break;

                    default:
                        $reason = "Invalid logger type($type) for {$name} specified in log config file: $config_file";
                        throw new ModuleInstallationException(self::class, $reason);
                        break;
                }
                $log_manager->register($name, $logger);

                $event_channel->push(Events::LOGGER_CHANNEL_CREATED, [
                        'name' => $name,
                        'logger' => $logger,
                    ]);
            }
        }
        catch(EventStreamException $e)
        {
            throw new ModuleInstallationException(self::class, $e->getMessage(), $e);
        }
    }
Install module

@param ApplicationInterface $app

@throws ModuleInstallationException