@@ -43,43 +43,43 @@ |
||
43 | 43 | */ |
44 | 44 | class LoggerAppenderSyslog extends LoggerAppenderSkeleton { |
45 | 45 | |
46 | - /** |
|
47 | - * Constructor |
|
48 | - * |
|
49 | - * @param string $name appender name |
|
50 | - */ |
|
51 | - public function LoggerAppenderSyslog($name) |
|
52 | - { |
|
53 | - $this->LoggerAppenderSkeleton($name); |
|
54 | - } |
|
46 | + /** |
|
47 | + * Constructor |
|
48 | + * |
|
49 | + * @param string $name appender name |
|
50 | + */ |
|
51 | + public function LoggerAppenderSyslog($name) |
|
52 | + { |
|
53 | + $this->LoggerAppenderSkeleton($name); |
|
54 | + } |
|
55 | 55 | |
56 | - public function activateOptions() |
|
57 | - { |
|
58 | - define_syslog_variables(); |
|
59 | - $this->closed = false; |
|
60 | - } |
|
56 | + public function activateOptions() |
|
57 | + { |
|
58 | + define_syslog_variables(); |
|
59 | + $this->closed = false; |
|
60 | + } |
|
61 | 61 | |
62 | - public function close() |
|
63 | - { |
|
64 | - closelog(); |
|
65 | - $this->closed = true; |
|
66 | - } |
|
62 | + public function close() |
|
63 | + { |
|
64 | + closelog(); |
|
65 | + $this->closed = true; |
|
66 | + } |
|
67 | 67 | |
68 | - public function append($event) |
|
69 | - { |
|
70 | - $level = $event->getLevel(); |
|
71 | - $message = $event->getRenderedMessage(); |
|
72 | - if ($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) { |
|
73 | - syslog(LOG_ALERT, $message); |
|
74 | - } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) { |
|
75 | - syslog(LOG_ERR, $message); |
|
76 | - } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) { |
|
77 | - syslog(LOG_WARNING, $message); |
|
78 | - } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) { |
|
79 | - syslog(LOG_INFO, $message); |
|
80 | - } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) { |
|
81 | - syslog(LOG_DEBUG, $message); |
|
82 | - } |
|
83 | - } |
|
68 | + public function append($event) |
|
69 | + { |
|
70 | + $level = $event->getLevel(); |
|
71 | + $message = $event->getRenderedMessage(); |
|
72 | + if ($level->isGreaterOrEqual(LoggerLevel::getLevelFatal())) { |
|
73 | + syslog(LOG_ALERT, $message); |
|
74 | + } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) { |
|
75 | + syslog(LOG_ERR, $message); |
|
76 | + } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) { |
|
77 | + syslog(LOG_WARNING, $message); |
|
78 | + } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelInfo())) { |
|
79 | + syslog(LOG_INFO, $message); |
|
80 | + } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelDebug())) { |
|
81 | + syslog(LOG_DEBUG, $message); |
|
82 | + } |
|
83 | + } |
|
84 | 84 | } |
85 | 85 | ?> |
86 | 86 | \ No newline at end of file |
@@ -39,203 +39,203 @@ |
||
39 | 39 | */ |
40 | 40 | class LoggerAppenderRollingFile extends LoggerAppenderFile { |
41 | 41 | |
42 | - /** |
|
43 | - * Set the maximum size that the output file is allowed to reach |
|
44 | - * before being rolled over to backup files. |
|
45 | - * |
|
46 | - * <p>In configuration files, the <var>MaxFileSize</var> option takes a |
|
47 | - * long integer in the range 0 - 2^63. You can specify the value |
|
48 | - * with the suffixes "KB", "MB" or "GB" so that the integer is |
|
49 | - * interpreted being expressed respectively in kilobytes, megabytes |
|
50 | - * or gigabytes. For example, the value "10KB" will be interpreted |
|
51 | - * as 10240.</p> |
|
52 | - * <p>The default maximum file size is 10MB.</p> |
|
53 | - * |
|
54 | - * <p>Note that MaxFileSize cannot exceed <b>2 GB</b>.</p> |
|
55 | - * |
|
56 | - * @var integer |
|
57 | - */ |
|
58 | - var $maxFileSize = 10485760; |
|
42 | + /** |
|
43 | + * Set the maximum size that the output file is allowed to reach |
|
44 | + * before being rolled over to backup files. |
|
45 | + * |
|
46 | + * <p>In configuration files, the <var>MaxFileSize</var> option takes a |
|
47 | + * long integer in the range 0 - 2^63. You can specify the value |
|
48 | + * with the suffixes "KB", "MB" or "GB" so that the integer is |
|
49 | + * interpreted being expressed respectively in kilobytes, megabytes |
|
50 | + * or gigabytes. For example, the value "10KB" will be interpreted |
|
51 | + * as 10240.</p> |
|
52 | + * <p>The default maximum file size is 10MB.</p> |
|
53 | + * |
|
54 | + * <p>Note that MaxFileSize cannot exceed <b>2 GB</b>.</p> |
|
55 | + * |
|
56 | + * @var integer |
|
57 | + */ |
|
58 | + var $maxFileSize = 10485760; |
|
59 | 59 | |
60 | - /** |
|
61 | - * Set the maximum number of backup files to keep around. |
|
62 | - * |
|
63 | - * <p>The <var>MaxBackupIndex</var> option determines how many backup |
|
64 | - * files are kept before the oldest is erased. This option takes |
|
65 | - * a positive integer value. If set to zero, then there will be no |
|
66 | - * backup files and the log file will be truncated when it reaches |
|
67 | - * MaxFileSize.</p> |
|
68 | - * <p>There is one backup file by default.</p> |
|
69 | - * |
|
70 | - * @var integer |
|
71 | - */ |
|
72 | - var $maxBackupIndex = 1; |
|
60 | + /** |
|
61 | + * Set the maximum number of backup files to keep around. |
|
62 | + * |
|
63 | + * <p>The <var>MaxBackupIndex</var> option determines how many backup |
|
64 | + * files are kept before the oldest is erased. This option takes |
|
65 | + * a positive integer value. If set to zero, then there will be no |
|
66 | + * backup files and the log file will be truncated when it reaches |
|
67 | + * MaxFileSize.</p> |
|
68 | + * <p>There is one backup file by default.</p> |
|
69 | + * |
|
70 | + * @var integer |
|
71 | + */ |
|
72 | + var $maxBackupIndex = 1; |
|
73 | 73 | |
74 | - /** |
|
75 | - * @var string the filename expanded |
|
76 | - * @access private |
|
77 | - */ |
|
78 | - var $expandedFileName = null; |
|
74 | + /** |
|
75 | + * @var string the filename expanded |
|
76 | + * @access private |
|
77 | + */ |
|
78 | + var $expandedFileName = null; |
|
79 | 79 | |
80 | - /** |
|
81 | - * Constructor. |
|
82 | - * |
|
83 | - * @param string $name appender name |
|
84 | - */ |
|
85 | - public function LoggerAppenderRollingFile($name) |
|
86 | - { |
|
87 | - $this->LoggerAppenderFile($name); |
|
88 | - } |
|
80 | + /** |
|
81 | + * Constructor. |
|
82 | + * |
|
83 | + * @param string $name appender name |
|
84 | + */ |
|
85 | + public function LoggerAppenderRollingFile($name) |
|
86 | + { |
|
87 | + $this->LoggerAppenderFile($name); |
|
88 | + } |
|
89 | 89 | |
90 | - /** |
|
91 | - * Returns the value of the MaxBackupIndex option. |
|
92 | - * @return integer |
|
93 | - */ |
|
94 | - public function getExpandedFileName() { |
|
95 | - return $this->expandedFileName; |
|
96 | - } |
|
90 | + /** |
|
91 | + * Returns the value of the MaxBackupIndex option. |
|
92 | + * @return integer |
|
93 | + */ |
|
94 | + public function getExpandedFileName() { |
|
95 | + return $this->expandedFileName; |
|
96 | + } |
|
97 | 97 | |
98 | - /** |
|
99 | - * Returns the value of the MaxBackupIndex option. |
|
100 | - * @return integer |
|
101 | - */ |
|
102 | - public function getMaxBackupIndex() { |
|
103 | - return $this->maxBackupIndex; |
|
104 | - } |
|
98 | + /** |
|
99 | + * Returns the value of the MaxBackupIndex option. |
|
100 | + * @return integer |
|
101 | + */ |
|
102 | + public function getMaxBackupIndex() { |
|
103 | + return $this->maxBackupIndex; |
|
104 | + } |
|
105 | 105 | |
106 | - /** |
|
107 | - * Get the maximum size that the output file is allowed to reach |
|
108 | - * before being rolled over to backup files. |
|
109 | - * @return integer |
|
110 | - */ |
|
111 | - public function getMaximumFileSize() { |
|
112 | - return $this->maxFileSize; |
|
113 | - } |
|
106 | + /** |
|
107 | + * Get the maximum size that the output file is allowed to reach |
|
108 | + * before being rolled over to backup files. |
|
109 | + * @return integer |
|
110 | + */ |
|
111 | + public function getMaximumFileSize() { |
|
112 | + return $this->maxFileSize; |
|
113 | + } |
|
114 | 114 | |
115 | - /** |
|
116 | - * Implements the usual roll over behaviour. |
|
117 | - * |
|
118 | - * <p>If MaxBackupIndex is positive, then files File.1, ..., File.MaxBackupIndex -1 are renamed to File.2, ..., File.MaxBackupIndex. |
|
119 | - * Moreover, File is renamed File.1 and closed. A new File is created to receive further log output. |
|
120 | - * |
|
121 | - * <p>If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created. |
|
122 | - */ |
|
123 | - public function rollOver() |
|
124 | - { |
|
125 | - // If maxBackups <= 0, then there is no file renaming to be done. |
|
126 | - if($this->maxBackupIndex > 0) { |
|
127 | - $fileName = $this->getExpandedFileName(); |
|
128 | - // Delete the oldest file, to keep Windows happy. |
|
129 | - $file = $fileName . '.' . $this->maxBackupIndex; |
|
130 | - if (is_writable($file)) |
|
131 | - unlink($file); |
|
132 | - // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2} |
|
133 | - for ($i = $this->maxBackupIndex - 1; $i >= 1; $i--) { |
|
134 | - $file = $fileName . "." . $i; |
|
135 | - if (is_readable($file)) { |
|
136 | - $target = $fileName . '.' . ($i + 1); |
|
137 | - rename($file, $target); |
|
138 | - } |
|
139 | - } |
|
115 | + /** |
|
116 | + * Implements the usual roll over behaviour. |
|
117 | + * |
|
118 | + * <p>If MaxBackupIndex is positive, then files File.1, ..., File.MaxBackupIndex -1 are renamed to File.2, ..., File.MaxBackupIndex. |
|
119 | + * Moreover, File is renamed File.1 and closed. A new File is created to receive further log output. |
|
120 | + * |
|
121 | + * <p>If MaxBackupIndex is equal to zero, then the File is truncated with no backup files created. |
|
122 | + */ |
|
123 | + public function rollOver() |
|
124 | + { |
|
125 | + // If maxBackups <= 0, then there is no file renaming to be done. |
|
126 | + if($this->maxBackupIndex > 0) { |
|
127 | + $fileName = $this->getExpandedFileName(); |
|
128 | + // Delete the oldest file, to keep Windows happy. |
|
129 | + $file = $fileName . '.' . $this->maxBackupIndex; |
|
130 | + if (is_writable($file)) |
|
131 | + unlink($file); |
|
132 | + // Map {(maxBackupIndex - 1), ..., 2, 1} to {maxBackupIndex, ..., 3, 2} |
|
133 | + for ($i = $this->maxBackupIndex - 1; $i >= 1; $i--) { |
|
134 | + $file = $fileName . "." . $i; |
|
135 | + if (is_readable($file)) { |
|
136 | + $target = $fileName . '.' . ($i + 1); |
|
137 | + rename($file, $target); |
|
138 | + } |
|
139 | + } |
|
140 | 140 | |
141 | - // Rename fileName to fileName.1 |
|
142 | - $target = $fileName . ".1"; |
|
141 | + // Rename fileName to fileName.1 |
|
142 | + $target = $fileName . ".1"; |
|
143 | 143 | |
144 | - $this->closeFile(); // keep windows happy. |
|
144 | + $this->closeFile(); // keep windows happy. |
|
145 | 145 | |
146 | - $file = $fileName; |
|
146 | + $file = $fileName; |
|
147 | 147 | |
148 | - //As of now suppress the error in rename. we have to handle in future |
|
149 | - @rename($file, $target); |
|
150 | - } |
|
148 | + //As of now suppress the error in rename. we have to handle in future |
|
149 | + @rename($file, $target); |
|
150 | + } |
|
151 | 151 | |
152 | - $this->setFile($fileName, false); |
|
153 | - unset($this->fp); |
|
154 | - $this->activateOptions(); |
|
155 | - } |
|
152 | + $this->setFile($fileName, false); |
|
153 | + unset($this->fp); |
|
154 | + $this->activateOptions(); |
|
155 | + } |
|
156 | 156 | |
157 | - public function setFileName($fileName) |
|
158 | - { |
|
159 | - $this->fileName = $fileName; |
|
160 | - $this->expandedFileName = realpath($fileName); |
|
161 | - LoggerLog::debug("LoggerAppenderRollingFile::setFileName():filename=[{$fileName}]:expandedFileName=[{$this->expandedFileName}]"); |
|
162 | - } |
|
157 | + public function setFileName($fileName) |
|
158 | + { |
|
159 | + $this->fileName = $fileName; |
|
160 | + $this->expandedFileName = realpath($fileName); |
|
161 | + LoggerLog::debug("LoggerAppenderRollingFile::setFileName():filename=[{$fileName}]:expandedFileName=[{$this->expandedFileName}]"); |
|
162 | + } |
|
163 | 163 | |
164 | 164 | |
165 | - /** |
|
166 | - * Set the maximum number of backup files to keep around. |
|
167 | - * |
|
168 | - * <p>The <b>MaxBackupIndex</b> option determines how many backup |
|
169 | - * files are kept before the oldest is erased. This option takes |
|
170 | - * a positive integer value. If set to zero, then there will be no |
|
171 | - * backup files and the log file will be truncated when it reaches |
|
172 | - * MaxFileSize. |
|
173 | - * |
|
174 | - * @param mixed $maxBackups |
|
175 | - */ |
|
176 | - public function setMaxBackupIndex($maxBackups) |
|
177 | - { |
|
178 | - if (is_numeric($maxBackups)) |
|
179 | - $this->maxBackupIndex = abs((int)$maxBackups); |
|
180 | - } |
|
165 | + /** |
|
166 | + * Set the maximum number of backup files to keep around. |
|
167 | + * |
|
168 | + * <p>The <b>MaxBackupIndex</b> option determines how many backup |
|
169 | + * files are kept before the oldest is erased. This option takes |
|
170 | + * a positive integer value. If set to zero, then there will be no |
|
171 | + * backup files and the log file will be truncated when it reaches |
|
172 | + * MaxFileSize. |
|
173 | + * |
|
174 | + * @param mixed $maxBackups |
|
175 | + */ |
|
176 | + public function setMaxBackupIndex($maxBackups) |
|
177 | + { |
|
178 | + if (is_numeric($maxBackups)) |
|
179 | + $this->maxBackupIndex = abs((int)$maxBackups); |
|
180 | + } |
|
181 | 181 | |
182 | - /** |
|
183 | - * Set the maximum size that the output file is allowed to reach |
|
184 | - * before being rolled over to backup files. |
|
185 | - * |
|
186 | - * @param mixed $maxFileSize |
|
187 | - * @see setMaxFileSize() |
|
188 | - */ |
|
189 | - public function setMaximumFileSize($maxFileSize) |
|
190 | - { |
|
191 | - $this->setMaxFileSize($maxFileSize); |
|
192 | - } |
|
182 | + /** |
|
183 | + * Set the maximum size that the output file is allowed to reach |
|
184 | + * before being rolled over to backup files. |
|
185 | + * |
|
186 | + * @param mixed $maxFileSize |
|
187 | + * @see setMaxFileSize() |
|
188 | + */ |
|
189 | + public function setMaximumFileSize($maxFileSize) |
|
190 | + { |
|
191 | + $this->setMaxFileSize($maxFileSize); |
|
192 | + } |
|
193 | 193 | |
194 | - /** |
|
195 | - * Set the maximum size that the output file is allowed to reach |
|
196 | - * before being rolled over to backup files. |
|
197 | - * <p>In configuration files, the <b>MaxFileSize</b> option takes an |
|
198 | - * long integer in the range 0 - 2^63. You can specify the value |
|
199 | - * with the suffixes "KB", "MB" or "GB" so that the integer is |
|
200 | - * interpreted being expressed respectively in kilobytes, megabytes |
|
201 | - * or gigabytes. For example, the value "10KB" will be interpreted |
|
202 | - * as 10240. |
|
203 | - * |
|
204 | - * @param mixed $value |
|
205 | - */ |
|
206 | - public function setMaxFileSize($value) |
|
207 | - { |
|
208 | - $maxFileSize = null; |
|
209 | - $numpart = substr($value,0, strlen($value) -2); |
|
210 | - $suffix = strtoupper(substr($value, -2)); |
|
194 | + /** |
|
195 | + * Set the maximum size that the output file is allowed to reach |
|
196 | + * before being rolled over to backup files. |
|
197 | + * <p>In configuration files, the <b>MaxFileSize</b> option takes an |
|
198 | + * long integer in the range 0 - 2^63. You can specify the value |
|
199 | + * with the suffixes "KB", "MB" or "GB" so that the integer is |
|
200 | + * interpreted being expressed respectively in kilobytes, megabytes |
|
201 | + * or gigabytes. For example, the value "10KB" will be interpreted |
|
202 | + * as 10240. |
|
203 | + * |
|
204 | + * @param mixed $value |
|
205 | + */ |
|
206 | + public function setMaxFileSize($value) |
|
207 | + { |
|
208 | + $maxFileSize = null; |
|
209 | + $numpart = substr($value,0, strlen($value) -2); |
|
210 | + $suffix = strtoupper(substr($value, -2)); |
|
211 | 211 | |
212 | - switch ($suffix) { |
|
213 | - case 'KB': $maxFileSize = (int)((int)$numpart * 1024); break; |
|
214 | - case 'MB': $maxFileSize = (int)((int)$numpart * 1024 * 1024); break; |
|
215 | - case 'GB': $maxFileSize = (int)((int)$numpart * 1024 * 1024 * 1024); break; |
|
216 | - default: |
|
217 | - if (is_numeric($value)) { |
|
218 | - $maxFileSize = (int)$value; |
|
219 | - } |
|
220 | - } |
|
212 | + switch ($suffix) { |
|
213 | + case 'KB': $maxFileSize = (int)((int)$numpart * 1024); break; |
|
214 | + case 'MB': $maxFileSize = (int)((int)$numpart * 1024 * 1024); break; |
|
215 | + case 'GB': $maxFileSize = (int)((int)$numpart * 1024 * 1024 * 1024); break; |
|
216 | + default: |
|
217 | + if (is_numeric($value)) { |
|
218 | + $maxFileSize = (int)$value; |
|
219 | + } |
|
220 | + } |
|
221 | 221 | |
222 | - if ($maxFileSize === null) { |
|
223 | - LoggerLog::debug("LoggerAppenderRollingFile::setMaxFileSize():value=[$value] wrong declaration"); |
|
224 | - } else { |
|
225 | - $this->maxFileSize = abs($maxFileSize); |
|
226 | - } |
|
227 | - } |
|
222 | + if ($maxFileSize === null) { |
|
223 | + LoggerLog::debug("LoggerAppenderRollingFile::setMaxFileSize():value=[$value] wrong declaration"); |
|
224 | + } else { |
|
225 | + $this->maxFileSize = abs($maxFileSize); |
|
226 | + } |
|
227 | + } |
|
228 | 228 | |
229 | - /** |
|
230 | - * @param LoggerLoggingEvent $event |
|
231 | - */ |
|
232 | - public function append($event) |
|
233 | - { |
|
234 | - if ($this->fp) { |
|
235 | - parent::append($event); |
|
236 | - if (ftell($this->fp) > $this->getMaximumFileSize()) |
|
237 | - $this->rollOver(); |
|
238 | - } |
|
239 | - } |
|
229 | + /** |
|
230 | + * @param LoggerLoggingEvent $event |
|
231 | + */ |
|
232 | + public function append($event) |
|
233 | + { |
|
234 | + if ($this->fp) { |
|
235 | + parent::append($event); |
|
236 | + if (ftell($this->fp) > $this->getMaximumFileSize()) |
|
237 | + $this->rollOver(); |
|
238 | + } |
|
239 | + } |
|
240 | 240 | } |
241 | 241 | ?> |
@@ -46,125 +46,125 @@ |
||
46 | 46 | */ |
47 | 47 | class LoggerAppenderMailEvent extends LoggerAppenderSkeleton { |
48 | 48 | |
49 | - /** |
|
50 | - * @var string 'from' field |
|
51 | - */ |
|
52 | - var $from = null; |
|
53 | - |
|
54 | - /** |
|
55 | - * @var integer 'from' field |
|
56 | - */ |
|
57 | - var $port = 25; |
|
58 | - |
|
59 | - /** |
|
60 | - * @var string hostname. |
|
61 | - */ |
|
62 | - var $smtpHost = null; |
|
63 | - |
|
64 | - /** |
|
65 | - * @var string 'subject' field |
|
66 | - */ |
|
67 | - var $subject = ''; |
|
68 | - |
|
69 | - /** |
|
70 | - * @var string 'to' field |
|
71 | - */ |
|
72 | - var $to = null; |
|
49 | + /** |
|
50 | + * @var string 'from' field |
|
51 | + */ |
|
52 | + var $from = null; |
|
53 | + |
|
54 | + /** |
|
55 | + * @var integer 'from' field |
|
56 | + */ |
|
57 | + var $port = 25; |
|
58 | + |
|
59 | + /** |
|
60 | + * @var string hostname. |
|
61 | + */ |
|
62 | + var $smtpHost = null; |
|
63 | + |
|
64 | + /** |
|
65 | + * @var string 'subject' field |
|
66 | + */ |
|
67 | + var $subject = ''; |
|
68 | + |
|
69 | + /** |
|
70 | + * @var string 'to' field |
|
71 | + */ |
|
72 | + var $to = null; |
|
73 | 73 | |
74 | - /** |
|
75 | - * @access private |
|
76 | - */ |
|
77 | - var $requiresLayout = true; |
|
78 | - |
|
79 | - /** |
|
80 | - * Constructor. |
|
81 | - * |
|
82 | - * @param string $name appender name |
|
83 | - */ |
|
84 | - public function LoggerAppenderMailEvent($name) |
|
85 | - { |
|
86 | - $this->LoggerAppenderSkeleton($name); |
|
87 | - } |
|
88 | - |
|
89 | - public function activateOptions() |
|
90 | - { |
|
91 | - $this->closed = false; |
|
92 | - } |
|
74 | + /** |
|
75 | + * @access private |
|
76 | + */ |
|
77 | + var $requiresLayout = true; |
|
78 | + |
|
79 | + /** |
|
80 | + * Constructor. |
|
81 | + * |
|
82 | + * @param string $name appender name |
|
83 | + */ |
|
84 | + public function LoggerAppenderMailEvent($name) |
|
85 | + { |
|
86 | + $this->LoggerAppenderSkeleton($name); |
|
87 | + } |
|
88 | + |
|
89 | + public function activateOptions() |
|
90 | + { |
|
91 | + $this->closed = false; |
|
92 | + } |
|
93 | 93 | |
94 | - public function close() |
|
95 | - { |
|
96 | - $this->closed = true; |
|
97 | - } |
|
98 | - |
|
99 | - /** |
|
100 | - * @return string |
|
101 | - */ |
|
102 | - public function getFrom() { return $this->from; } |
|
94 | + public function close() |
|
95 | + { |
|
96 | + $this->closed = true; |
|
97 | + } |
|
98 | + |
|
99 | + /** |
|
100 | + * @return string |
|
101 | + */ |
|
102 | + public function getFrom() { return $this->from; } |
|
103 | 103 | |
104 | - /** |
|
105 | - * @return integer |
|
106 | - */ |
|
107 | - public function getPort() { return $this->port; } |
|
104 | + /** |
|
105 | + * @return integer |
|
106 | + */ |
|
107 | + public function getPort() { return $this->port; } |
|
108 | 108 | |
109 | - /** |
|
110 | - * @return string |
|
111 | - */ |
|
112 | - public function getSmtpHost() { return $this->smtpHost; } |
|
109 | + /** |
|
110 | + * @return string |
|
111 | + */ |
|
112 | + public function getSmtpHost() { return $this->smtpHost; } |
|
113 | 113 | |
114 | - /** |
|
115 | - * @return string |
|
116 | - */ |
|
117 | - public function getSubject() { return $this->subject; } |
|
118 | - |
|
119 | - /** |
|
120 | - * @return string |
|
121 | - */ |
|
122 | - public function getTo() { return $this->to; } |
|
123 | - |
|
124 | - public function setFrom($from) { $this->from = $from; } |
|
125 | - public function setPort($port) { $this->port = (int)$port; } |
|
126 | - public function setSmtpHost($smtphost) { $this->smtpHost = $smtpHost; } |
|
127 | - public function setSubject($subject) { $this->subject = $subject; } |
|
128 | - public function setTo($to) { $this->to = $to; } |
|
129 | - |
|
130 | - public function append($event) |
|
131 | - { |
|
132 | - $from = $this->getFrom(); |
|
133 | - $to = $this->getTo(); |
|
134 | - if (empty($from) || empty($to)) |
|
135 | - return; |
|
114 | + /** |
|
115 | + * @return string |
|
116 | + */ |
|
117 | + public function getSubject() { return $this->subject; } |
|
118 | + |
|
119 | + /** |
|
120 | + * @return string |
|
121 | + */ |
|
122 | + public function getTo() { return $this->to; } |
|
123 | + |
|
124 | + public function setFrom($from) { $this->from = $from; } |
|
125 | + public function setPort($port) { $this->port = (int)$port; } |
|
126 | + public function setSmtpHost($smtphost) { $this->smtpHost = $smtpHost; } |
|
127 | + public function setSubject($subject) { $this->subject = $subject; } |
|
128 | + public function setTo($to) { $this->to = $to; } |
|
129 | + |
|
130 | + public function append($event) |
|
131 | + { |
|
132 | + $from = $this->getFrom(); |
|
133 | + $to = $this->getTo(); |
|
134 | + if (empty($from) || empty($to)) |
|
135 | + return; |
|
136 | 136 | |
137 | - $smtpHost = $this->getSmtpHost(); |
|
138 | - $prevSmtpHost = ini_get('SMTP'); |
|
139 | - if (!empty($smtpHost)) { |
|
140 | - ini_set('SMTP', $smtpHost); |
|
141 | - } else { |
|
142 | - $smtpHost = $prevSmtpHost; |
|
143 | - } |
|
144 | - |
|
145 | - $smtpPort = $this->getPort(); |
|
146 | - $prevSmtpPort= ini_get('smtp_port'); |
|
147 | - if ($smtpPort > 0 && $smtpPort < 65535) { |
|
148 | - ini_set('smtp_port', $smtpPort); |
|
149 | - } else { |
|
150 | - $smtpPort = $prevSmtpPort; |
|
151 | - } |
|
137 | + $smtpHost = $this->getSmtpHost(); |
|
138 | + $prevSmtpHost = ini_get('SMTP'); |
|
139 | + if (!empty($smtpHost)) { |
|
140 | + ini_set('SMTP', $smtpHost); |
|
141 | + } else { |
|
142 | + $smtpHost = $prevSmtpHost; |
|
143 | + } |
|
144 | + |
|
145 | + $smtpPort = $this->getPort(); |
|
146 | + $prevSmtpPort= ini_get('smtp_port'); |
|
147 | + if ($smtpPort > 0 && $smtpPort < 65535) { |
|
148 | + ini_set('smtp_port', $smtpPort); |
|
149 | + } else { |
|
150 | + $smtpPort = $prevSmtpPort; |
|
151 | + } |
|
152 | 152 | |
153 | - LoggerLog::debug( |
|
154 | - "LoggerAppenderMailEvent::append()" . |
|
155 | - ":from=[{$from}]:to=[{$to}]:smtpHost=[{$smtpHost}]:smtpPort=[{$smtpPort}]" |
|
156 | - ); |
|
153 | + LoggerLog::debug( |
|
154 | + "LoggerAppenderMailEvent::append()" . |
|
155 | + ":from=[{$from}]:to=[{$to}]:smtpHost=[{$smtpHost}]:smtpPort=[{$smtpPort}]" |
|
156 | + ); |
|
157 | 157 | |
158 | - if (!@mail( $to, $this->getSubject(), |
|
159 | - $this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), |
|
160 | - "From: {$from}\r\n" |
|
161 | - )) { |
|
162 | - LoggerLog::debug("LoggerAppenderMailEvent::append() mail error"); |
|
163 | - } |
|
158 | + if (!@mail( $to, $this->getSubject(), |
|
159 | + $this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), |
|
160 | + "From: {$from}\r\n" |
|
161 | + )) { |
|
162 | + LoggerLog::debug("LoggerAppenderMailEvent::append() mail error"); |
|
163 | + } |
|
164 | 164 | |
165 | - ini_set('SMTP', $prevSmtpHost); |
|
166 | - ini_set('smtp_port', $prevSmtpPort); |
|
167 | - } |
|
165 | + ini_set('SMTP', $prevSmtpHost); |
|
166 | + ini_set('smtp_port', $prevSmtpPort); |
|
167 | + } |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | ?> |
171 | 171 | \ No newline at end of file |
@@ -49,27 +49,27 @@ discard block |
||
49 | 49 | /** |
50 | 50 | * @var string 'from' field |
51 | 51 | */ |
52 | - var $from = null; |
|
52 | + var $from = null; |
|
53 | 53 | |
54 | 54 | /** |
55 | 55 | * @var integer 'from' field |
56 | 56 | */ |
57 | - var $port = 25; |
|
57 | + var $port = 25; |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * @var string hostname. |
61 | 61 | */ |
62 | - var $smtpHost = null; |
|
62 | + var $smtpHost = null; |
|
63 | 63 | |
64 | 64 | /** |
65 | 65 | * @var string 'subject' field |
66 | 66 | */ |
67 | - var $subject = ''; |
|
67 | + var $subject = ''; |
|
68 | 68 | |
69 | 69 | /** |
70 | 70 | * @var string 'to' field |
71 | 71 | */ |
72 | - var $to = null; |
|
72 | + var $to = null; |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * @access private |
@@ -99,33 +99,33 @@ discard block |
||
99 | 99 | /** |
100 | 100 | * @return string |
101 | 101 | */ |
102 | - public function getFrom() { return $this->from; } |
|
102 | + public function getFrom() { return $this->from; } |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * @return integer |
106 | 106 | */ |
107 | - public function getPort() { return $this->port; } |
|
107 | + public function getPort() { return $this->port; } |
|
108 | 108 | |
109 | 109 | /** |
110 | 110 | * @return string |
111 | 111 | */ |
112 | - public function getSmtpHost() { return $this->smtpHost; } |
|
112 | + public function getSmtpHost() { return $this->smtpHost; } |
|
113 | 113 | |
114 | 114 | /** |
115 | 115 | * @return string |
116 | 116 | */ |
117 | - public function getSubject() { return $this->subject; } |
|
117 | + public function getSubject() { return $this->subject; } |
|
118 | 118 | |
119 | 119 | /** |
120 | 120 | * @return string |
121 | 121 | */ |
122 | - public function getTo() { return $this->to; } |
|
122 | + public function getTo() { return $this->to; } |
|
123 | 123 | |
124 | - public function setFrom($from) { $this->from = $from; } |
|
125 | - public function setPort($port) { $this->port = (int)$port; } |
|
126 | - public function setSmtpHost($smtphost) { $this->smtpHost = $smtpHost; } |
|
127 | - public function setSubject($subject) { $this->subject = $subject; } |
|
128 | - public function setTo($to) { $this->to = $to; } |
|
124 | + public function setFrom($from) { $this->from = $from; } |
|
125 | + public function setPort($port) { $this->port = (int) $port; } |
|
126 | + public function setSmtpHost($smtphost) { $this->smtpHost = $smtpHost; } |
|
127 | + public function setSubject($subject) { $this->subject = $subject; } |
|
128 | + public function setTo($to) { $this->to = $to; } |
|
129 | 129 | |
130 | 130 | public function append($event) |
131 | 131 | { |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | $smtpPort = $this->getPort(); |
146 | - $prevSmtpPort= ini_get('smtp_port'); |
|
146 | + $prevSmtpPort = ini_get('smtp_port'); |
|
147 | 147 | if ($smtpPort > 0 && $smtpPort < 65535) { |
148 | 148 | ini_set('smtp_port', $smtpPort); |
149 | 149 | } else { |
@@ -155,15 +155,15 @@ discard block |
||
155 | 155 | ":from=[{$from}]:to=[{$to}]:smtpHost=[{$smtpHost}]:smtpPort=[{$smtpPort}]" |
156 | 156 | ); |
157 | 157 | |
158 | - if (!@mail( $to, $this->getSubject(), |
|
158 | + if (!@mail($to, $this->getSubject(), |
|
159 | 159 | $this->layout->getHeader() . $this->layout->format($event) . $this->layout->getFooter($event), |
160 | 160 | "From: {$from}\r\n" |
161 | 161 | )) { |
162 | 162 | LoggerLog::debug("LoggerAppenderMailEvent::append() mail error"); |
163 | 163 | } |
164 | 164 | |
165 | - ini_set('SMTP', $prevSmtpHost); |
|
166 | - ini_set('smtp_port', $prevSmtpPort); |
|
165 | + ini_set('SMTP', $prevSmtpHost); |
|
166 | + ini_set('smtp_port', $prevSmtpPort); |
|
167 | 167 | } |
168 | 168 | } |
169 | 169 |
@@ -35,38 +35,38 @@ |
||
35 | 35 | */ |
36 | 36 | class LoggerAppenderNull extends LoggerAppenderSkeleton { |
37 | 37 | |
38 | - /** |
|
39 | - * @access private |
|
40 | - */ |
|
41 | - var $requiresLayout = false; |
|
38 | + /** |
|
39 | + * @access private |
|
40 | + */ |
|
41 | + var $requiresLayout = false; |
|
42 | 42 | |
43 | - /** |
|
44 | - * Constructor. |
|
45 | - * |
|
46 | - * @param string $name appender name |
|
47 | - */ |
|
48 | - public function LoggerAppenderNull($name) |
|
49 | - { |
|
50 | - $this->LoggerAppenderSkeleton($name); |
|
51 | - } |
|
43 | + /** |
|
44 | + * Constructor. |
|
45 | + * |
|
46 | + * @param string $name appender name |
|
47 | + */ |
|
48 | + public function LoggerAppenderNull($name) |
|
49 | + { |
|
50 | + $this->LoggerAppenderSkeleton($name); |
|
51 | + } |
|
52 | 52 | |
53 | - public function activateOptions() |
|
54 | - { |
|
55 | - $this->closed = false; |
|
56 | - } |
|
53 | + public function activateOptions() |
|
54 | + { |
|
55 | + $this->closed = false; |
|
56 | + } |
|
57 | 57 | |
58 | - public function close() |
|
59 | - { |
|
60 | - $this->closed = true; |
|
61 | - } |
|
58 | + public function close() |
|
59 | + { |
|
60 | + $this->closed = true; |
|
61 | + } |
|
62 | 62 | |
63 | - /** |
|
64 | - * Do nothing. How I Love it !! :) |
|
65 | - */ |
|
66 | - public function append($event) |
|
67 | - { |
|
68 | - LoggerLog::debug("LoggerAppenderNull::append()"); |
|
69 | - } |
|
63 | + /** |
|
64 | + * Do nothing. How I Love it !! :) |
|
65 | + */ |
|
66 | + public function append($event) |
|
67 | + { |
|
68 | + LoggerLog::debug("LoggerAppenderNull::append()"); |
|
69 | + } |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | ?> |
73 | 73 | \ No newline at end of file |
@@ -39,146 +39,146 @@ |
||
39 | 39 | */ |
40 | 40 | class LoggerAppenderFile extends LoggerAppenderSkeleton { |
41 | 41 | |
42 | - /** |
|
43 | - * @var boolean if {@link $file} exists, appends events. |
|
44 | - */ |
|
45 | - var $append = true; |
|
42 | + /** |
|
43 | + * @var boolean if {@link $file} exists, appends events. |
|
44 | + */ |
|
45 | + var $append = true; |
|
46 | 46 | |
47 | - /** |
|
48 | - * @var string the file name used to append events |
|
49 | - */ |
|
50 | - var $fileName; |
|
47 | + /** |
|
48 | + * @var string the file name used to append events |
|
49 | + */ |
|
50 | + var $fileName; |
|
51 | 51 | |
52 | - /** |
|
53 | - * @var mixed file resource |
|
54 | - * @access private |
|
55 | - */ |
|
56 | - var $fp = false; |
|
52 | + /** |
|
53 | + * @var mixed file resource |
|
54 | + * @access private |
|
55 | + */ |
|
56 | + var $fp = false; |
|
57 | 57 | |
58 | - /** |
|
59 | - * @access private |
|
60 | - */ |
|
61 | - var $requiresLayout = true; |
|
58 | + /** |
|
59 | + * @access private |
|
60 | + */ |
|
61 | + var $requiresLayout = true; |
|
62 | 62 | |
63 | - /** |
|
64 | - * Constructor. |
|
65 | - * |
|
66 | - * @param string $name appender name |
|
67 | - */ |
|
68 | - public function LoggerAppenderFile($name) |
|
69 | - { |
|
70 | - $this->LoggerAppenderSkeleton($name); |
|
71 | - } |
|
63 | + /** |
|
64 | + * Constructor. |
|
65 | + * |
|
66 | + * @param string $name appender name |
|
67 | + */ |
|
68 | + public function LoggerAppenderFile($name) |
|
69 | + { |
|
70 | + $this->LoggerAppenderSkeleton($name); |
|
71 | + } |
|
72 | 72 | |
73 | - public function activateOptions() |
|
74 | - { |
|
75 | - $fileName = $this->getFile(); |
|
76 | - LoggerLog::debug("LoggerAppenderFile::activateOptions() opening file '{$fileName}'"); |
|
77 | - $this->fp = @fopen($fileName, ($this->getAppend()? 'a':'w')); |
|
73 | + public function activateOptions() |
|
74 | + { |
|
75 | + $fileName = $this->getFile(); |
|
76 | + LoggerLog::debug("LoggerAppenderFile::activateOptions() opening file '{$fileName}'"); |
|
77 | + $this->fp = @fopen($fileName, ($this->getAppend()? 'a':'w')); |
|
78 | 78 | |
79 | 79 | // Denying read option for log file. Added for Vulnerability fix |
80 | 80 | if (is_readable($fileName)) chmod ($fileName,0222); |
81 | 81 | |
82 | - if ($this->fp) { |
|
83 | - if ($this->getAppend()) |
|
84 | - fseek($this->fp, 0, SEEK_END); |
|
85 | - @fwrite($this->fp, $this->layout->getHeader()); |
|
86 | - $this->closed = false; |
|
87 | - } else { |
|
88 | - $this->closed = true; |
|
89 | - } |
|
90 | - } |
|
82 | + if ($this->fp) { |
|
83 | + if ($this->getAppend()) |
|
84 | + fseek($this->fp, 0, SEEK_END); |
|
85 | + @fwrite($this->fp, $this->layout->getHeader()); |
|
86 | + $this->closed = false; |
|
87 | + } else { |
|
88 | + $this->closed = true; |
|
89 | + } |
|
90 | + } |
|
91 | 91 | |
92 | - public function close() |
|
93 | - { |
|
94 | - if ($this->fp && $this->layout !== null) |
|
95 | - @fwrite($this->fp, $this->layout->getFooter()); |
|
92 | + public function close() |
|
93 | + { |
|
94 | + if ($this->fp && $this->layout !== null) |
|
95 | + @fwrite($this->fp, $this->layout->getFooter()); |
|
96 | 96 | |
97 | - $this->closeFile(); |
|
98 | - $this->closed = true; |
|
99 | - } |
|
97 | + $this->closeFile(); |
|
98 | + $this->closed = true; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Closes the previously opened file. |
|
103 | - */ |
|
104 | - public function closeFile() |
|
105 | - { |
|
106 | - if ($this->fp) |
|
107 | - @fclose($this->fp); |
|
108 | - } |
|
101 | + /** |
|
102 | + * Closes the previously opened file. |
|
103 | + */ |
|
104 | + public function closeFile() |
|
105 | + { |
|
106 | + if ($this->fp) |
|
107 | + @fclose($this->fp); |
|
108 | + } |
|
109 | 109 | |
110 | - /** |
|
111 | - * @return boolean |
|
112 | - */ |
|
113 | - public function getAppend() |
|
114 | - { |
|
115 | - return $this->append; |
|
116 | - } |
|
110 | + /** |
|
111 | + * @return boolean |
|
112 | + */ |
|
113 | + public function getAppend() |
|
114 | + { |
|
115 | + return $this->append; |
|
116 | + } |
|
117 | 117 | |
118 | - /** |
|
119 | - * @return string |
|
120 | - */ |
|
121 | - public function getFile() |
|
122 | - { |
|
123 | - return $this->getFileName(); |
|
124 | - } |
|
118 | + /** |
|
119 | + * @return string |
|
120 | + */ |
|
121 | + public function getFile() |
|
122 | + { |
|
123 | + return $this->getFileName(); |
|
124 | + } |
|
125 | 125 | |
126 | - /** |
|
127 | - * @return string |
|
128 | - */ |
|
129 | - public function getFileName() |
|
130 | - { |
|
131 | - return $this->fileName; |
|
132 | - } |
|
126 | + /** |
|
127 | + * @return string |
|
128 | + */ |
|
129 | + public function getFileName() |
|
130 | + { |
|
131 | + return $this->fileName; |
|
132 | + } |
|
133 | 133 | |
134 | - /** |
|
135 | - * Close any previously opened file and call the parent's reset. |
|
136 | - */ |
|
137 | - public function reset() |
|
138 | - { |
|
139 | - $this->closeFile(); |
|
140 | - $this->fileName = null; |
|
141 | - parent::reset(); |
|
142 | - } |
|
134 | + /** |
|
135 | + * Close any previously opened file and call the parent's reset. |
|
136 | + */ |
|
137 | + public function reset() |
|
138 | + { |
|
139 | + $this->closeFile(); |
|
140 | + $this->fileName = null; |
|
141 | + parent::reset(); |
|
142 | + } |
|
143 | 143 | |
144 | - public function setAppend($flag) |
|
145 | - { |
|
146 | - $this->append = LoggerOptionConverter::toBoolean($flag, true); |
|
147 | - } |
|
144 | + public function setAppend($flag) |
|
145 | + { |
|
146 | + $this->append = LoggerOptionConverter::toBoolean($flag, true); |
|
147 | + } |
|
148 | 148 | |
149 | - /** |
|
150 | - * Sets and opens the file where the log output will go. |
|
151 | - * |
|
152 | - * This is an overloaded method. It can be called with: |
|
153 | - * - setFile(string $fileName) to set filename. |
|
154 | - * - setFile(string $fileName, boolean $append) to set filename and append. |
|
155 | - */ |
|
156 | - public function setFile() |
|
157 | - { |
|
158 | - $numargs = func_num_args(); |
|
159 | - $args = func_get_args(); |
|
149 | + /** |
|
150 | + * Sets and opens the file where the log output will go. |
|
151 | + * |
|
152 | + * This is an overloaded method. It can be called with: |
|
153 | + * - setFile(string $fileName) to set filename. |
|
154 | + * - setFile(string $fileName, boolean $append) to set filename and append. |
|
155 | + */ |
|
156 | + public function setFile() |
|
157 | + { |
|
158 | + $numargs = func_num_args(); |
|
159 | + $args = func_get_args(); |
|
160 | 160 | |
161 | - if ($numargs == 1 && is_string($args[0])) { |
|
162 | - $this->setFileName($args[0]); |
|
163 | - } elseif ($numargs >=2 && is_string($args[0]) && is_bool($args[1])) { |
|
164 | - $this->setFile($args[0]); |
|
165 | - $this->setAppend($args[1]); |
|
166 | - } |
|
167 | - } |
|
161 | + if ($numargs == 1 && is_string($args[0])) { |
|
162 | + $this->setFileName($args[0]); |
|
163 | + } elseif ($numargs >=2 && is_string($args[0]) && is_bool($args[1])) { |
|
164 | + $this->setFile($args[0]); |
|
165 | + $this->setAppend($args[1]); |
|
166 | + } |
|
167 | + } |
|
168 | 168 | |
169 | - public function setFileName($fileName) |
|
170 | - { |
|
171 | - $this->fileName = $fileName; |
|
172 | - } |
|
169 | + public function setFileName($fileName) |
|
170 | + { |
|
171 | + $this->fileName = $fileName; |
|
172 | + } |
|
173 | 173 | |
174 | - public function append($event) |
|
175 | - { |
|
176 | - if ($this->fp && $this->layout !== null) { |
|
174 | + public function append($event) |
|
175 | + { |
|
176 | + if ($this->fp && $this->layout !== null) { |
|
177 | 177 | |
178 | - LoggerLog::debug("LoggerAppenderFile::append()"); |
|
178 | + LoggerLog::debug("LoggerAppenderFile::append()"); |
|
179 | 179 | |
180 | - @fwrite($this->fp, $this->layout->format($event)); |
|
181 | - } |
|
182 | - } |
|
180 | + @fwrite($this->fp, $this->layout->format($event)); |
|
181 | + } |
|
182 | + } |
|
183 | 183 | } |
184 | 184 | ?> |
@@ -39,51 +39,51 @@ |
||
39 | 39 | */ |
40 | 40 | class LoggerAppenderEcho extends LoggerAppenderSkeleton { |
41 | 41 | |
42 | - /** |
|
43 | - * @access private |
|
44 | - */ |
|
45 | - var $requiresLayout = true; |
|
42 | + /** |
|
43 | + * @access private |
|
44 | + */ |
|
45 | + var $requiresLayout = true; |
|
46 | 46 | |
47 | - /** |
|
48 | - * @var boolean used internally to mark first append |
|
49 | - * @access private |
|
50 | - */ |
|
51 | - var $firstAppend = true; |
|
47 | + /** |
|
48 | + * @var boolean used internally to mark first append |
|
49 | + * @access private |
|
50 | + */ |
|
51 | + var $firstAppend = true; |
|
52 | 52 | |
53 | - /** |
|
54 | - * Constructor. |
|
55 | - * |
|
56 | - * @param string $name appender name |
|
57 | - */ |
|
58 | - public function LoggerAppenderEcho($name) |
|
59 | - { |
|
60 | - $this->LoggerAppenderSkeleton($name); |
|
61 | - } |
|
53 | + /** |
|
54 | + * Constructor. |
|
55 | + * |
|
56 | + * @param string $name appender name |
|
57 | + */ |
|
58 | + public function LoggerAppenderEcho($name) |
|
59 | + { |
|
60 | + $this->LoggerAppenderSkeleton($name); |
|
61 | + } |
|
62 | 62 | |
63 | - public function activateOptions() |
|
64 | - { |
|
65 | - return; |
|
66 | - } |
|
63 | + public function activateOptions() |
|
64 | + { |
|
65 | + return; |
|
66 | + } |
|
67 | 67 | |
68 | - public function close() |
|
69 | - { |
|
70 | - if (!$this->firstAppend) |
|
71 | - echo $this->layout->getFooter(); |
|
72 | - $this->closed = true; |
|
73 | - } |
|
68 | + public function close() |
|
69 | + { |
|
70 | + if (!$this->firstAppend) |
|
71 | + echo $this->layout->getFooter(); |
|
72 | + $this->closed = true; |
|
73 | + } |
|
74 | 74 | |
75 | - public function append($event) |
|
76 | - { |
|
77 | - LoggerLog::debug("LoggerAppenderEcho::append()"); |
|
75 | + public function append($event) |
|
76 | + { |
|
77 | + LoggerLog::debug("LoggerAppenderEcho::append()"); |
|
78 | 78 | |
79 | - if ($this->layout !== null) { |
|
80 | - if ($this->firstAppend) { |
|
81 | - echo $this->layout->getHeader(); |
|
82 | - $this->firstAppend = false; |
|
83 | - } |
|
84 | - echo $this->layout->format($event); |
|
85 | - } |
|
86 | - } |
|
79 | + if ($this->layout !== null) { |
|
80 | + if ($this->firstAppend) { |
|
81 | + echo $this->layout->getHeader(); |
|
82 | + $this->firstAppend = false; |
|
83 | + } |
|
84 | + echo $this->layout->format($event); |
|
85 | + } |
|
86 | + } |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | ?> |
90 | 90 | \ No newline at end of file |
@@ -41,45 +41,45 @@ |
||
41 | 41 | */ |
42 | 42 | class LoggerAppenderPhp extends LoggerAppenderSkeleton { |
43 | 43 | |
44 | - /** |
|
45 | - * @access private |
|
46 | - */ |
|
47 | - var $requiresLayout = false; |
|
44 | + /** |
|
45 | + * @access private |
|
46 | + */ |
|
47 | + var $requiresLayout = false; |
|
48 | 48 | |
49 | - /** |
|
50 | - * Constructor |
|
51 | - * |
|
52 | - * @param string $name appender name |
|
53 | - */ |
|
54 | - public function LoggerAppenderPhp($name) |
|
55 | - { |
|
56 | - $this->LoggerAppenderSkeleton($name); |
|
57 | - } |
|
49 | + /** |
|
50 | + * Constructor |
|
51 | + * |
|
52 | + * @param string $name appender name |
|
53 | + */ |
|
54 | + public function LoggerAppenderPhp($name) |
|
55 | + { |
|
56 | + $this->LoggerAppenderSkeleton($name); |
|
57 | + } |
|
58 | 58 | |
59 | - public function activateOptions() |
|
60 | - { |
|
61 | - $this->layout = LoggerLayout::factory('LoggerLayoutTTCC'); |
|
62 | - $this->closed = false; |
|
63 | - } |
|
59 | + public function activateOptions() |
|
60 | + { |
|
61 | + $this->layout = LoggerLayout::factory('LoggerLayoutTTCC'); |
|
62 | + $this->closed = false; |
|
63 | + } |
|
64 | 64 | |
65 | - public function close() |
|
66 | - { |
|
67 | - $this->closed = true; |
|
68 | - } |
|
65 | + public function close() |
|
66 | + { |
|
67 | + $this->closed = true; |
|
68 | + } |
|
69 | 69 | |
70 | - public function append($event) |
|
71 | - { |
|
72 | - if ($this->layout !== null) { |
|
73 | - LoggerLog::debug("LoggerAppenderPhp::append()"); |
|
74 | - $level = $event->getLevel(); |
|
75 | - if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) { |
|
76 | - trigger_error($this->layout->format($event), E_USER_ERROR); |
|
77 | - } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) { |
|
78 | - trigger_error($this->layout->format($event), E_USER_WARNING); |
|
79 | - } else { |
|
80 | - trigger_error($this->layout->format($event), E_USER_NOTICE); |
|
81 | - } |
|
82 | - } |
|
83 | - } |
|
70 | + public function append($event) |
|
71 | + { |
|
72 | + if ($this->layout !== null) { |
|
73 | + LoggerLog::debug("LoggerAppenderPhp::append()"); |
|
74 | + $level = $event->getLevel(); |
|
75 | + if ($level->isGreaterOrEqual(LoggerLevel::getLevelError())) { |
|
76 | + trigger_error($this->layout->format($event), E_USER_ERROR); |
|
77 | + } elseif ($level->isGreaterOrEqual(LoggerLevel::getLevelWarn())) { |
|
78 | + trigger_error($this->layout->format($event), E_USER_WARNING); |
|
79 | + } else { |
|
80 | + trigger_error($this->layout->format($event), E_USER_NOTICE); |
|
81 | + } |
|
82 | + } |
|
83 | + } |
|
84 | 84 | } |
85 | 85 | ?> |
86 | 86 | \ No newline at end of file |
@@ -38,111 +38,111 @@ |
||
38 | 38 | */ |
39 | 39 | class LoggerAppenderMail extends LoggerAppenderSkeleton { |
40 | 40 | |
41 | - /** |
|
42 | - * @var string 'from' field |
|
43 | - */ |
|
44 | - var $from = null; |
|
41 | + /** |
|
42 | + * @var string 'from' field |
|
43 | + */ |
|
44 | + var $from = null; |
|
45 | 45 | |
46 | - /** |
|
47 | - * @var string 'subject' field |
|
48 | - */ |
|
49 | - var $subject = 'Log4php Report'; |
|
46 | + /** |
|
47 | + * @var string 'subject' field |
|
48 | + */ |
|
49 | + var $subject = 'Log4php Report'; |
|
50 | 50 | |
51 | - /** |
|
52 | - * @var string 'to' field |
|
53 | - */ |
|
54 | - var $to = null; |
|
51 | + /** |
|
52 | + * @var string 'to' field |
|
53 | + */ |
|
54 | + var $to = null; |
|
55 | 55 | |
56 | - /** |
|
57 | - * @var string used to create mail body |
|
58 | - * @access private |
|
59 | - */ |
|
60 | - var $body = ''; |
|
56 | + /** |
|
57 | + * @var string used to create mail body |
|
58 | + * @access private |
|
59 | + */ |
|
60 | + var $body = ''; |
|
61 | 61 | |
62 | - /** |
|
63 | - * @access private |
|
64 | - */ |
|
65 | - var $requiresLayout = true; |
|
62 | + /** |
|
63 | + * @access private |
|
64 | + */ |
|
65 | + var $requiresLayout = true; |
|
66 | 66 | |
67 | - /** |
|
68 | - * Constructor. |
|
69 | - * |
|
70 | - * @param string $name appender name |
|
71 | - */ |
|
72 | - public function LoggerAppenderMail($name) |
|
73 | - { |
|
74 | - $this->LoggerAppenderSkeleton($name); |
|
75 | - } |
|
67 | + /** |
|
68 | + * Constructor. |
|
69 | + * |
|
70 | + * @param string $name appender name |
|
71 | + */ |
|
72 | + public function LoggerAppenderMail($name) |
|
73 | + { |
|
74 | + $this->LoggerAppenderSkeleton($name); |
|
75 | + } |
|
76 | 76 | |
77 | - public function activateOptions() |
|
78 | - { |
|
79 | - $this->closed = false; |
|
80 | - return; |
|
81 | - } |
|
77 | + public function activateOptions() |
|
78 | + { |
|
79 | + $this->closed = false; |
|
80 | + return; |
|
81 | + } |
|
82 | 82 | |
83 | - public function close() |
|
84 | - { |
|
85 | - $from = $this->getFrom(); |
|
86 | - $to = $this->getTo(); |
|
83 | + public function close() |
|
84 | + { |
|
85 | + $from = $this->getFrom(); |
|
86 | + $to = $this->getTo(); |
|
87 | 87 | |
88 | - if (!empty($this->body) && $from !== null && $to !== null && $this->layout !== null) { |
|
88 | + if (!empty($this->body) && $from !== null && $to !== null && $this->layout !== null) { |
|
89 | 89 | |
90 | - $subject = $this->getSubject(); |
|
90 | + $subject = $this->getSubject(); |
|
91 | 91 | |
92 | - LoggerLog::debug("LoggerAppenderMail::close() sending mail from=[{$from}] to=[{$to}] subject=[{$subject}]"); |
|
92 | + LoggerLog::debug("LoggerAppenderMail::close() sending mail from=[{$from}] to=[{$to}] subject=[{$subject}]"); |
|
93 | 93 | |
94 | - @mail( |
|
95 | - $to, $subject, |
|
96 | - $this->layout->getHeader() . $this->body . $this->layout->getFooter(), |
|
97 | - "From: {$from}\r\n" |
|
98 | - ); |
|
99 | - } |
|
100 | - $this->closed = true; |
|
101 | - } |
|
94 | + @mail( |
|
95 | + $to, $subject, |
|
96 | + $this->layout->getHeader() . $this->body . $this->layout->getFooter(), |
|
97 | + "From: {$from}\r\n" |
|
98 | + ); |
|
99 | + } |
|
100 | + $this->closed = true; |
|
101 | + } |
|
102 | 102 | |
103 | - /** |
|
104 | - * @return string |
|
105 | - */ |
|
106 | - public function getFrom() |
|
107 | - { |
|
108 | - return $this->from; |
|
109 | - } |
|
103 | + /** |
|
104 | + * @return string |
|
105 | + */ |
|
106 | + public function getFrom() |
|
107 | + { |
|
108 | + return $this->from; |
|
109 | + } |
|
110 | 110 | |
111 | - /** |
|
112 | - * @return string |
|
113 | - */ |
|
114 | - public function getSubject() |
|
115 | - { |
|
116 | - return $this->subject; |
|
117 | - } |
|
111 | + /** |
|
112 | + * @return string |
|
113 | + */ |
|
114 | + public function getSubject() |
|
115 | + { |
|
116 | + return $this->subject; |
|
117 | + } |
|
118 | 118 | |
119 | - /** |
|
120 | - * @return string |
|
121 | - */ |
|
122 | - public function getTo() |
|
123 | - { |
|
124 | - return $this->to; |
|
125 | - } |
|
119 | + /** |
|
120 | + * @return string |
|
121 | + */ |
|
122 | + public function getTo() |
|
123 | + { |
|
124 | + return $this->to; |
|
125 | + } |
|
126 | 126 | |
127 | - public function setSubject($subject) |
|
128 | - { |
|
129 | - $this->subject = $subject; |
|
130 | - } |
|
127 | + public function setSubject($subject) |
|
128 | + { |
|
129 | + $this->subject = $subject; |
|
130 | + } |
|
131 | 131 | |
132 | - public function setTo($to) |
|
133 | - { |
|
134 | - $this->to = $to; |
|
135 | - } |
|
132 | + public function setTo($to) |
|
133 | + { |
|
134 | + $this->to = $to; |
|
135 | + } |
|
136 | 136 | |
137 | - public function setFrom($from) |
|
138 | - { |
|
139 | - $this->from = $from; |
|
140 | - } |
|
137 | + public function setFrom($from) |
|
138 | + { |
|
139 | + $this->from = $from; |
|
140 | + } |
|
141 | 141 | |
142 | - public function append($event) |
|
143 | - { |
|
144 | - if ($this->layout !== null) |
|
145 | - $this->body .= $this->layout->format($event); |
|
146 | - } |
|
142 | + public function append($event) |
|
143 | + { |
|
144 | + if ($this->layout !== null) |
|
145 | + $this->body .= $this->layout->format($event); |
|
146 | + } |
|
147 | 147 | } |
148 | 148 | ?> |
149 | 149 | \ No newline at end of file |
@@ -40,57 +40,57 @@ |
||
40 | 40 | */ |
41 | 41 | class LoggerAppenderDailyFile extends LoggerAppenderFile { |
42 | 42 | |
43 | - /** |
|
44 | - * Format date. |
|
45 | - * It follows the {@link PHP_MANUAL#date()} formatting rules and <b>should always be set before {@link $file} param</b>. |
|
46 | - * @var string |
|
47 | - */ |
|
48 | - var $datePattern = "Ymd"; |
|
43 | + /** |
|
44 | + * Format date. |
|
45 | + * It follows the {@link PHP_MANUAL#date()} formatting rules and <b>should always be set before {@link $file} param</b>. |
|
46 | + * @var string |
|
47 | + */ |
|
48 | + var $datePattern = "Ymd"; |
|
49 | 49 | |
50 | - /** |
|
51 | - * Constructor |
|
52 | - * |
|
53 | - * @param string $name appender name |
|
54 | - */ |
|
55 | - public function LoggerAppenderDailyFile($name) |
|
56 | - { |
|
57 | - $this->LoggerAppenderFile($name); |
|
58 | - } |
|
50 | + /** |
|
51 | + * Constructor |
|
52 | + * |
|
53 | + * @param string $name appender name |
|
54 | + */ |
|
55 | + public function LoggerAppenderDailyFile($name) |
|
56 | + { |
|
57 | + $this->LoggerAppenderFile($name); |
|
58 | + } |
|
59 | 59 | |
60 | - /** |
|
61 | - * Sets date format for the file name. |
|
62 | - * @param string $format a regular date() string format |
|
63 | - */ |
|
64 | - public function setDatePattern ( $format ) |
|
65 | - { |
|
66 | - $this->datePattern = $format; |
|
67 | - } |
|
60 | + /** |
|
61 | + * Sets date format for the file name. |
|
62 | + * @param string $format a regular date() string format |
|
63 | + */ |
|
64 | + public function setDatePattern ( $format ) |
|
65 | + { |
|
66 | + $this->datePattern = $format; |
|
67 | + } |
|
68 | 68 | |
69 | - /** |
|
70 | - * @return string returns date format for the filename |
|
71 | - */ |
|
72 | - public function getDatePattern ( ) |
|
73 | - { |
|
74 | - return $this->datePattern; |
|
75 | - } |
|
69 | + /** |
|
70 | + * @return string returns date format for the filename |
|
71 | + */ |
|
72 | + public function getDatePattern ( ) |
|
73 | + { |
|
74 | + return $this->datePattern; |
|
75 | + } |
|
76 | 76 | |
77 | - /** |
|
78 | - * The File property takes a string value which should be the name of the file to append to. |
|
79 | - * Sets and opens the file where the log output will go. |
|
80 | - * |
|
81 | - * @see LoggerAppenderFile::setFile() |
|
82 | - */ |
|
83 | - public function setFile() |
|
84 | - { |
|
85 | - $numargs = func_num_args(); |
|
86 | - $args = func_get_args(); |
|
77 | + /** |
|
78 | + * The File property takes a string value which should be the name of the file to append to. |
|
79 | + * Sets and opens the file where the log output will go. |
|
80 | + * |
|
81 | + * @see LoggerAppenderFile::setFile() |
|
82 | + */ |
|
83 | + public function setFile() |
|
84 | + { |
|
85 | + $numargs = func_num_args(); |
|
86 | + $args = func_get_args(); |
|
87 | 87 | |
88 | - if ($numargs == 1 && is_string($args[0])) { |
|
89 | - parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())) ); |
|
90 | - } elseif ($numargs == 2 && is_string($args[0]) && is_bool($args[1])) { |
|
91 | - parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())), $args[1] ); |
|
92 | - } |
|
93 | - } |
|
88 | + if ($numargs == 1 && is_string($args[0])) { |
|
89 | + parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())) ); |
|
90 | + } elseif ($numargs == 2 && is_string($args[0]) && is_bool($args[1])) { |
|
91 | + parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())), $args[1] ); |
|
92 | + } |
|
93 | + } |
|
94 | 94 | |
95 | 95 | } |
96 | 96 |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * Sets date format for the file name. |
62 | 62 | * @param string $format a regular date() string format |
63 | 63 | */ |
64 | - public function setDatePattern ( $format ) |
|
64 | + public function setDatePattern($format) |
|
65 | 65 | { |
66 | 66 | $this->datePattern = $format; |
67 | 67 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | /** |
70 | 70 | * @return string returns date format for the filename |
71 | 71 | */ |
72 | - public function getDatePattern ( ) |
|
72 | + public function getDatePattern( ) |
|
73 | 73 | { |
74 | 74 | return $this->datePattern; |
75 | 75 | } |
@@ -86,9 +86,9 @@ discard block |
||
86 | 86 | $args = func_get_args(); |
87 | 87 | |
88 | 88 | if ($numargs == 1 && is_string($args[0])) { |
89 | - parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())) ); |
|
89 | + parent::setFile(sprintf((string) $args[0], date($this->getDatePattern()))); |
|
90 | 90 | } elseif ($numargs == 2 && is_string($args[0]) && is_bool($args[1])) { |
91 | - parent::setFile( sprintf((string)$args[0], date($this->getDatePattern())), $args[1] ); |
|
91 | + parent::setFile(sprintf((string) $args[0], date($this->getDatePattern())), $args[1]); |
|
92 | 92 | } |
93 | 93 | } |
94 | 94 |