You are here

class LagoonLogsLoggerFactory in Lagoon Logs 8

Hierarchy

Expanded class hierarchy of LagoonLogsLoggerFactory

1 file declares its use of LagoonLogsLoggerFactory
LagoonLogsInfoController.php in src/LagoonLogsInfoController.php

File

src/Logger/LagoonLogsLoggerFactory.php, line 8

Namespace

Drupal\lagoon_logs\Logger
View source
class LagoonLogsLoggerFactory {
  const LAGOON_LOGS_DEFAULT_SAFE_BRANCH = 'safe_branch_unset';
  const LAGOON_LOGS_DEFAULT_LAGOON_PROJECT = 'project_unset';
  public static function create(ConfigFactoryInterface $config, LogMessageParserInterface $parser) {
    $host = $config
      ->get('lagoon_logs.settings')
      ->get('host');
    $port = $config
      ->get('lagoon_logs.settings')
      ->get('port');
    return new LagoonLogsLogger($host, $port, self::getHostProcessIndex($config), $parser);
  }
  public static function getHostProcessIndex(ConfigFactoryInterface $config) {
    return implode('-', [
      getenv('LAGOON_PROJECT') ?: self::LAGOON_LOGS_DEFAULT_LAGOON_PROJECT,
      getenv('LAGOON_GIT_SAFE_BRANCH') ?: self::LAGOON_LOGS_DEFAULT_SAFE_BRANCH,
    ]);
  }

}

Members