/** * Class constructor. Feeds in output destination from env vars * * @param [array] $options Options for operation of logger * [array] config Configuration options from Runner * @param [string] $logDirectory File path to the logging directory * @param [string] $logLevelThreshold The LogLevel Threshold * @return [Logger] $this */ public function __construct(array $options = array(), $logDirectory = 'php://stderr', $logLevelThreshold = LogLevel::INFO) { $config = $options['config']; unset($options['config']); $options['dateFormat'] = 'Y-m-d H:i:s'; if ($config['debug']) { $logLevelThreshold = LogLevel::DEBUG; } if (!isset($options['logFormat'])) { if ($config['json'] != null) { $options['logFormat'] = 'json'; } if ($config['bash'] != null) { $options['logFormat'] = 'bash'; } } if (isset($_SERVER['TERMINUS_LOG_DIR'])) { $logDirectory = $_SERVER['TERMINUS_LOG_DIR']; } elseif ($config['silent']) { $logDirectory = ini_get('error_log'); if ($logDirectory == '') { die('You must either set error_log in your php.ini, or define ' . ' TERMINUS_LOG_DIR to use silent mode.' . PHP_EOL); } } parent::__construct($logDirectory, $logLevelThreshold, $options); }
/** * custom class constructor * * @param string $logDirectory path to log directory * @param string $logLevelThreshold the log level * * @return void */ public function altConstructor($logDirectory, $logLevelThreshold = LogLevel::DEBUG) { parent::__construct($logDirectory, $logLevelThreshold); }
/** * The constructor. Sets up the logger service to log to a specific * path and file configured in environment.ini * @param store $store module\application\service\store */ public function __construct(store $store) { $env = $store->get('ENV'); parent::__construct(APPLICATION_ROOT . $env->log->path, LogLevel::DEBUG, ['filename' => $env->application->env . '.log']); }