1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* TechDivision\Import\Cli\Configuration\Logger |
5
|
|
|
* |
6
|
|
|
* NOTICE OF LICENSE |
7
|
|
|
* |
8
|
|
|
* This source file is subject to the Open Software License (OSL 3.0) |
9
|
|
|
* that is available through the world-wide-web at this URL: |
10
|
|
|
* http://opensource.org/licenses/osl-3.0.php |
11
|
|
|
* |
12
|
|
|
* PHP version 5 |
13
|
|
|
* |
14
|
|
|
* @author Tim Wagner <[email protected]> |
15
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
16
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
17
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
18
|
|
|
* @link http://www.techdivision.com |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
namespace TechDivision\Import\Cli\Configuration; |
22
|
|
|
|
23
|
|
|
use JMS\Serializer\Annotation\Type; |
24
|
|
|
use JMS\Serializer\Annotation\SerializedName; |
25
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
26
|
|
|
use TechDivision\Import\Configuration\LoggerConfigurationInterface; |
27
|
|
|
|
28
|
|
|
/** |
29
|
|
|
* The logger configuration. |
30
|
|
|
* |
31
|
|
|
* @author Tim Wagner <[email protected]> |
32
|
|
|
* @copyright 2016 TechDivision GmbH <[email protected]> |
33
|
|
|
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) |
34
|
|
|
* @link https://github.com/techdivision/import-cli-simple |
35
|
|
|
* @link http://www.techdivision.com |
36
|
|
|
*/ |
37
|
|
|
class Logger implements LoggerConfigurationInterface |
38
|
|
|
{ |
39
|
|
|
|
40
|
|
|
/** |
41
|
|
|
* The trait that provides parameter handling functionality. |
42
|
|
|
* |
43
|
|
|
* @var \TechDivision\Import\Cli\Configuration\ParamsTrait |
44
|
|
|
*/ |
45
|
|
|
use ParamsTrait; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* The logger's channel name to use. |
49
|
|
|
* |
50
|
|
|
* @var string |
51
|
|
|
* @Type("string") |
52
|
|
|
* @SerializedName("channel-name") |
53
|
|
|
*/ |
54
|
|
|
protected $channelName; |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* The logger's unique name to use. |
58
|
|
|
* |
59
|
|
|
* @var string |
60
|
|
|
* @Type("string") |
61
|
|
|
*/ |
62
|
|
|
protected $name; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* The logger's type to use. |
66
|
|
|
* |
67
|
|
|
* @var string |
68
|
|
|
* @Type("string") |
69
|
|
|
*/ |
70
|
|
|
protected $type; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* The factory used to create the logger instance. |
74
|
|
|
* |
75
|
|
|
* @var string |
76
|
|
|
* @Type("string") |
77
|
|
|
*/ |
78
|
|
|
protected $factory = 'TechDivision\Import\Cli\Configuration\LoggerFactory'; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* ArrayCollection with the information of the configured processors. |
82
|
|
|
* |
83
|
|
|
* @var \Doctrine\Common\Collections\ArrayCollection |
84
|
|
|
* @Type("ArrayCollection<TechDivision\Import\Cli\Configuration\Logger\Processor>") |
85
|
|
|
*/ |
86
|
|
|
protected $processors = array(); |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* ArrayCollection with the information of the configured handlers. |
90
|
|
|
* |
91
|
|
|
* @var \Doctrine\Common\Collections\ArrayCollection |
92
|
|
|
* @Type("ArrayCollection<TechDivision\Import\Cli\Configuration\Logger\Handler>") |
93
|
|
|
*/ |
94
|
|
|
protected $handlers = array(); |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* Initialize the logger instance. |
98
|
|
|
*/ |
99
|
|
|
public function __construct() |
100
|
|
|
{ |
101
|
|
|
$this->processors = new ArrayCollection(); |
102
|
|
|
$this->handlers = new ArrayCollection(); |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* Return's the logger's channel name to use. |
107
|
|
|
* |
108
|
|
|
* @return string The channel name |
109
|
|
|
*/ |
110
|
|
|
public function getChannelName() |
111
|
|
|
{ |
112
|
|
|
return $this->channelName; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Return's the logger's unique name to use. |
117
|
|
|
* |
118
|
|
|
* @return string The unique name |
119
|
|
|
*/ |
120
|
|
|
public function getName() |
121
|
|
|
{ |
122
|
|
|
return $this->name; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Return's the factory used to create the logger instance. |
127
|
|
|
* |
128
|
|
|
* @return string The factory to use |
129
|
|
|
*/ |
130
|
|
|
public function getFactory() |
131
|
|
|
{ |
132
|
|
|
return $this->factory; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* Return's the logger's type to use. |
137
|
|
|
* |
138
|
|
|
* @return string The type |
139
|
|
|
*/ |
140
|
|
|
public function getType() |
141
|
|
|
{ |
142
|
|
|
return $this->type; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* Return's the array with the logger's processors. |
147
|
|
|
* |
148
|
|
|
* @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the processors |
149
|
|
|
*/ |
150
|
|
|
public function getProcessors() |
151
|
|
|
{ |
152
|
|
|
return $this->processors; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
/** |
156
|
|
|
* Return's the array with the logger's handlers. |
157
|
|
|
* |
158
|
|
|
* @return \Doctrine\Common\Collections\ArrayCollection The ArrayCollection with the handlers |
159
|
|
|
*/ |
160
|
|
|
public function getHandlers() |
161
|
|
|
{ |
162
|
|
|
return $this->handlers; |
163
|
|
|
} |
164
|
|
|
} |
165
|
|
|
|