1 | <?php |
||
38 | class SyslogLogger implements Logger { |
||
39 | |||
40 | /** |
||
41 | * Declaration of the facility constants. |
||
42 | * @var integer |
||
43 | */ |
||
44 | const FACILITY_KERNEL = 0; |
||
45 | const FACILITY_USER_LEVEL = 1; |
||
46 | const FACILITY_MAIL = 2; |
||
47 | const FACILITY_DAEMON = 3; |
||
48 | const FACILITY_SECURITY = 4; |
||
49 | const FACILITY_SYSLOGD = 5; |
||
50 | const FACILITY_PRINTER = 6; |
||
51 | const FACILITY_NETWORK = 7; |
||
52 | const FACILITY_UUCP = 8; |
||
53 | const FACILITY_CLOCK = 9; |
||
54 | const FACILITY_AUTH = 10; |
||
55 | const FACILITY_FTP = 11; |
||
56 | const FACILITY_NTP = 12; |
||
57 | const FACILITY_LOG = 13; |
||
58 | const FACILITY_LOG_ALERT = 14; |
||
59 | const FACILITY_CLOCK_DAEMON = 15; |
||
60 | const FACILITY_USER_0 = 16; |
||
61 | const FACILITY_USER_1 = 17; |
||
62 | const FACILITY_USER_2 = 18; |
||
63 | const FACILITY_USER_3 = 19; |
||
64 | const FACILITY_USER_4 = 20; |
||
65 | const FACILITY_USER_5 = 21; |
||
66 | const FACILITY_USER_6 = 22; |
||
67 | const FACILITY_USER_7 = 23; |
||
68 | |||
69 | /** @var \Brickoo\Component\IO\Stream\SocketStream */ |
||
70 | private $socketStream; |
||
71 | |||
72 | /** @var string */ |
||
73 | private $hostname; |
||
74 | |||
75 | /** @var integer */ |
||
76 | private $facility; |
||
77 | |||
78 | /** |
||
79 | * Class constructor. |
||
80 | * @param \Brickoo\Component\IO\Stream\SocketStream $socketStream |
||
81 | * @param string $hostname the hostname of the machine running |
||
82 | * @param integer $facility the facility of the sending messages, default USER_0 |
||
83 | * @throws \InvalidArgumentException if an argument is not valid |
||
84 | */ |
||
85 | 1 | public function __construct(SocketStream $socketStream, $hostname, $facility = self::FACILITY_USER_0) { |
|
93 | |||
94 | /** {@inheritDoc} */ |
||
95 | 2 | public function log($messages, $severity) { |
|
105 | |||
106 | /** |
||
107 | * Sends the messages to the syslog server. |
||
108 | * @param array $messages the messages to send |
||
109 | * @param integer $severity the severity of the message(s) |
||
110 | * @return void |
||
111 | */ |
||
112 | 1 | private function sendMessages(array $messages, $severity) { |
|
122 | |||
123 | /** |
||
124 | * Returns the log message header. |
||
125 | * @param integer $severity the severity of the log message(s) |
||
126 | * @return string the log message header |
||
127 | */ |
||
128 | 1 | private function getMessageHeader($severity) { |
|
131 | |||
132 | } |
||
133 |