ILIAS
release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
◀ ilDoc Overview
GitProcessor.php
Go to the documentation of this file.
1
<?php
2
3
/*
4
* This file is part of the Monolog package.
5
*
6
* (c) Jordi Boggiano <j.boggiano@seld.be>
7
*
8
* For the full copyright and license information, please view the LICENSE
9
* file that was distributed with this source code.
10
*/
11
12
namespace
Monolog\Processor
;
13
14
use
Monolog\Logger
;
15
22
class
GitProcessor
23
{
24
private
$level
;
25
private
static
$cache
;
26
27
public
function
__construct
(
$level
=
Logger::DEBUG
)
28
{
29
$this->level =
Logger::toMonologLevel
(
$level
);
30
}
31
36
public
function
__invoke
(array $record)
37
{
38
// return if the level is not high enough
39
if
($record[
'level'
] < $this->level) {
40
return
$record;
41
}
42
43
$record[
'extra'
][
'git'
] = self::getGitInfo();
44
45
return
$record;
46
}
47
48
private
static
function
getGitInfo
()
49
{
50
if
(self::$cache) {
51
return
self::$cache;
52
}
53
54
$branches = `git branch -
v
--no-abbrev`;
55
if
(preg_match(
'{^\* (.+?)\s+([a-f0-9]{40})(?:\s|$)}m'
, $branches, $matches)) {
56
return
self::$cache = array(
57
'branch'
=> $matches[1],
58
'commit'
=> $matches[2],
59
);
60
}
61
62
return
self::$cache = array();
63
}
64
}
Monolog\Processor
Definition:
GitProcessor.php:12
Monolog\Logger\DEBUG
const DEBUG
Detailed debug information.
Definition:
Logger.php:32
Monolog\Processor\GitProcessor\getGitInfo
static getGitInfo()
Definition:
GitProcessor.php:48
Monolog\Processor\GitProcessor\__invoke
__invoke(array $record)
Definition:
GitProcessor.php:36
Monolog\Logger\toMonologLevel
static toMonologLevel($level)
Converts PSR-3 levels to Monolog ones if necessary.
Definition:
Logger.php:403
Logger
Monolog\Processor\GitProcessor\$cache
static $cache
Definition:
GitProcessor.php:25
v
v($data, $pos)
Definition:
excel_reader2.php:91
Monolog\Processor\GitProcessor\$level
$level
Definition:
GitProcessor.php:24
Monolog\Processor\GitProcessor\__construct
__construct($level=Logger::DEBUG)
Definition:
GitProcessor.php:27
Monolog\Processor\GitProcessor
Injects Git branch and Git commit SHA in all records.
Definition:
GitProcessor.php:22
Services
Logging
lib
vendor
monolog
monolog
src
Monolog
Processor
GitProcessor.php
Generated on Wed Aug 27 2025 19:00:55 for ILIAS by
1.8.13 (using
Doxyfile
)