Passed
Pull Request — master (#230)
by Arman
02:43
created

logger()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
c 0
b 0
f 0
nc 1
nop 1
dl 0
loc 3
rs 10
1
<?php
2
3
/**
4
 * Quantum PHP Framework
5
 *
6
 * An open source software development framework for PHP
7
 *
8
 * @package Quantum
9
 * @author Arman Ag. <[email protected]>
10
 * @copyright Copyright (c) 2018 Softberg LLC (https://softberg.org)
11
 * @link http://quantum.softberg.org/
12
 * @since 2.9.6
13
 */
14
15
use Quantum\Libraries\Config\Exceptions\ConfigException;
16
use Quantum\Libraries\Logger\Factories\LoggerFactory;
17
use Quantum\Di\Exceptions\DiException;
18
use Quantum\Exceptions\BaseException;
19
use Quantum\Libraries\Logger\Logger;
20
21
/**
22
 * @param string|null $adapter
23
 * @return Logger
24
 * @throws BaseException
25
 * @throws ConfigException
26
 * @throws DiException
27
 * @throws ReflectionException
28
 */
29
function logger(?string $adapter = null): Logger
30
{
31
    return LoggerFactory::get($adapter);
32
}
33
34
/**
35
 * Reports error
36
 * @param $var
37
 * @param array $context
38
 * @return void
39
 * @throws ConfigException
40
 * @throws DiException
41
 * @throws ReflectionException
42
 * @throws BaseException
43
 */
44
function error($var, array $context = [])
45
{
46
    LoggerFactory::get()->error($var, $context);
47
}
48
49
/**
50
 * Reports warning
51
 * @param $var
52
 * @param array $context
53
 * @return void
54
 * @throws BaseException
55
 * @throws ConfigException
56
 * @throws DiException
57
 * @throws ReflectionException
58
 */
59
function warning($var, array $context = [])
60
{
61
    LoggerFactory::get()->warning($var, $context);
62
}
63
64
/**
65
 * Reports notice
66
 * @param $var
67
 * @param array $context
68
 * @return void
69
 * @throws BaseException
70
 * @throws ConfigException
71
 * @throws DiException
72
 * @throws ReflectionException
73
 */
74
function notice($var, array $context = [])
75
{
76
    LoggerFactory::get()->notice($var, $context);
77
}
78
79
/**
80
 * Reports info
81
 * @param $var
82
 * @param array $context
83
 * @return void
84
 * @throws BaseException
85
 * @throws ConfigException
86
 * @throws DiException
87
 * @throws ReflectionException
88
 */
89
function info($var, array $context = [])
90
{
91
    LoggerFactory::get()->info($var, $context);
92
}
93
94
/**
95
 * Reports debug
96
 * @param $var
97
 * @param array $context
98
 * @return void
99
 * @throws BaseException
100
 * @throws ConfigException
101
 * @throws DiException
102
 * @throws ReflectionException
103
 */
104
function debug($var, array $context = [])
105
{
106
    LoggerFactory::get()->debug($var, $context);
107
}