ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilLoggingSetupConfig.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 2019 Richard Klees <richard.klees@concepts-and-training.de> Extended GPL, see docs/LICENSE */
4
6
8{
12 protected $enabled;
13
18
23
24 public function __construct(
25 bool $enabled,
26 ?string $path_to_logfile,
27 ?string $errorlog_dir
28 ) {
29 if ($enabled && !$path_to_logfile) {
30 throw new \InvalidArgumentException(
31 "Expected a path to the logfile, if logging is enabled."
32 );
33 }
34 $this->enabled = $enabled;
35 $this->path_to_logfile = $this->normalizePath($path_to_logfile);
36 $this->errorlog_dir = $this->normalizePath($errorlog_dir);
37 }
38
39 protected function normalizePath(?string $p) : ?string
40 {
41 if (!$p) {
42 return null;
43 }
44 $p = preg_replace("/\\\\/", "/", $p);
45 return preg_replace("%/+$%", "", $p);
46 }
47
48 public function isEnabled() : bool
49 {
50 return $this->enabled;
51 }
52
53 public function getPathToLogfile() : ?string
54 {
56 }
57
58 public function getErrorlogDir() : ?string
59 {
60 return $this->errorlog_dir;
61 }
62}
An exception for terminatinating execution or to throw for unit testing.
__construct(bool $enabled, ?string $path_to_logfile, ?string $errorlog_dir)
A configuration for the setup.
Definition: Config.php:11
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...