ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilLoggingSetupConfig.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
24{
25 protected bool $enabled;
26
27 protected ?string $path_to_logfile;
28 protected ?string $path_to_errorlogfiles;
29 protected ?string $errorlog_dir;
30
31 public function __construct(
32 bool $enabled,
33 ?string $path_to_logfile,
34 ?string $errorlog_dir
35 ) {
36 if ($enabled && !$path_to_logfile) {
37 throw new \InvalidArgumentException(
38 "Expected a path to the logfile, if logging is enabled."
39 );
40 }
41 $this->enabled = $enabled;
42 $this->path_to_logfile = $this->normalizePath($path_to_logfile);
43 $this->errorlog_dir = $this->normalizePath($errorlog_dir);
44 }
45
46 protected function normalizePath(?string $p): ?string
47 {
48 if (!$p) {
49 return null;
50 }
51 $p = preg_replace("/\\\\/", "/", $p);
52 return preg_replace("%/+$%", "", $p);
53 }
54
55 public function isEnabled(): bool
56 {
57 return $this->enabled;
58 }
59
60 public function getPathToLogfile(): ?string
61 {
63 }
64
65 public function getErrorlogDir(): ?string
66 {
68 }
69}
__construct(bool $enabled, ?string $path_to_logfile, ?string $errorlog_dir)
A configuration for the setup.
Definition: Config.php:27