‪TYPO3CMS  ‪main
Type.php
Go to the documentation of this file.
1 <?php
2 
3 declare(strict_types=1);
4 
5 /*
6  * This file is part of the TYPO3 CMS project.
7  *
8  * It is free software; you can redistribute it and/or modify it under
9  * the terms of the GNU General Public License, either version 2
10  * of the License, or any later version.
11  *
12  * For the full copyright and license information, please read the
13  * LICENSE.txt file that was distributed with this source code.
14  *
15  * The TYPO3 project - inspiring people to share!
16  */
17 
18 namespace ‪TYPO3\CMS\Core\SysLog;
19 
20 use Psr\Log\LogLevel;
21 
27 class ‪Type
28 {
29  public const ‪DB = 1;
30  public const ‪FILE = 2;
31  public const ‪CACHE = 3;
32  public const ‪EXTENSION = 4;
33  public const ‪ERROR = 5;
34  public const ‪SITE = 6;
35  public const ‪SETTING = 254;
36  public const ‪LOGIN = 255;
37 
38  private static array ‪$channelMap = [
39  self::DB => 'content',
40  self::FILE => 'file',
41  self::CACHE => 'default',
42  self::EXTENSION => 'default',
43  self::ERROR => 'php',
44  self::SITE => 'site',
45  self::SETTING => 'default',
46  self::LOGIN => 'user',
47  ];
48 
49  private static array ‪$levelMap = [
50  self::DB => LogLevel::INFO,
51  self::FILE => LogLevel::INFO,
52  self::CACHE => LogLevel::INFO,
53  self::EXTENSION => LogLevel::INFO,
54  self::ERROR => LogLevel::ERROR,
55  self::SITE => LogLevel::INFO,
56  self::SETTING => LogLevel::INFO,
57  self::LOGIN => LogLevel::INFO,
58  ];
59 
63  public static function ‪levelMap(): array
64  {
65  return ‪self::$levelMap;
66  }
67 
71  public static function ‪channelMap(): array
72  {
73  return ‪self::$channelMap;
74  }
75 
76  public static function ‪toChannel(int $type): string
77  {
78  return self::$channelMap[$type] ?? 'default';
79  }
80 
81  public static function ‪toLevel(int $type): string
82  {
83  return self::$levelMap[$type] ?? LogLevel::INFO;
84  }
85 }
‪TYPO3\CMS\Core\SysLog\Type\LOGIN
‪const LOGIN
Definition: Type.php:36
‪TYPO3\CMS\Core\SysLog\Type\SETTING
‪const SETTING
Definition: Type.php:35
‪TYPO3\CMS\Core\SysLog\Type\CACHE
‪const CACHE
Definition: Type.php:31
‪TYPO3\CMS\Core\SysLog\Type\SITE
‪const SITE
Definition: Type.php:34
‪TYPO3\CMS\Core\SysLog\Type\EXTENSION
‪const EXTENSION
Definition: Type.php:32
‪TYPO3\CMS\Core\SysLog\Type\FILE
‪const FILE
Definition: Type.php:30
‪TYPO3\CMS\Core\SysLog\Type\toChannel
‪static toChannel(int $type)
Definition: Type.php:76
‪TYPO3\CMS\Core\SysLog\Type\DB
‪const DB
Definition: Type.php:29
‪TYPO3\CMS\Core\SysLog\Type\channelMap
‪static channelMap()
Definition: Type.php:71
‪TYPO3\CMS\Core\SysLog\Type\$channelMap
‪static array $channelMap
Definition: Type.php:38
‪TYPO3\CMS\Core\SysLog
‪TYPO3\CMS\Core\SysLog\Type\levelMap
‪static levelMap()
Definition: Type.php:63
‪TYPO3\CMS\Core\SysLog\Type\$levelMap
‪static array $levelMap
Definition: Type.php:49
‪TYPO3\CMS\Core\SysLog\Type\ERROR
‪const ERROR
Definition: Type.php:33
‪TYPO3\CMS\Core\SysLog\Type\toLevel
‪static toLevel(int $type)
Definition: Type.php:81
‪TYPO3\CMS\Core\SysLog\Type
Definition: Type.php:28