@@ -73,233 +73,233 @@ |
||
| 73 | 73 | */ |
| 74 | 74 | class Payone_Log4php_LoggerAppenderSyslog extends Payone_Log4php_LoggerAppender { |
| 75 | 75 | |
| 76 | - /** |
|
| 77 | - * The ident string is added to each message. Typically the name of your application. |
|
| 78 | - * |
|
| 79 | - * @var string |
|
| 80 | - */ |
|
| 81 | - protected $ident = "Apache log4php"; |
|
| 76 | + /** |
|
| 77 | + * The ident string is added to each message. Typically the name of your application. |
|
| 78 | + * |
|
| 79 | + * @var string |
|
| 80 | + */ |
|
| 81 | + protected $ident = "Apache log4php"; |
|
| 82 | 82 | |
| 83 | - /** |
|
| 84 | - * The syslog priority to use when overriding priority. This setting is |
|
| 85 | - * required if {@link overridePriority} is set to true. |
|
| 86 | - * |
|
| 87 | - * @var string |
|
| 88 | - */ |
|
| 89 | - protected $priority; |
|
| 83 | + /** |
|
| 84 | + * The syslog priority to use when overriding priority. This setting is |
|
| 85 | + * required if {@link overridePriority} is set to true. |
|
| 86 | + * |
|
| 87 | + * @var string |
|
| 88 | + */ |
|
| 89 | + protected $priority; |
|
| 90 | 90 | |
| 91 | - /** |
|
| 92 | - * The option used when opening the syslog connection. |
|
| 93 | - * |
|
| 94 | - * @var string |
|
| 95 | - */ |
|
| 96 | - protected $option = 'PID|CONS'; |
|
| 91 | + /** |
|
| 92 | + * The option used when opening the syslog connection. |
|
| 93 | + * |
|
| 94 | + * @var string |
|
| 95 | + */ |
|
| 96 | + protected $option = 'PID|CONS'; |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * The facility value indicates the source of the message. |
|
| 100 | - * |
|
| 101 | - * @var string |
|
| 102 | - */ |
|
| 103 | - protected $facility = 'USER'; |
|
| 98 | + /** |
|
| 99 | + * The facility value indicates the source of the message. |
|
| 100 | + * |
|
| 101 | + * @var string |
|
| 102 | + */ |
|
| 103 | + protected $facility = 'USER'; |
|
| 104 | 104 | |
| 105 | - /** |
|
| 106 | - * If set to true, the message priority will always use the value defined |
|
| 107 | - * in {@link $priority}, otherwise the priority will be determined by the |
|
| 108 | - * message's log level. |
|
| 109 | - * |
|
| 110 | - * @var string |
|
| 111 | - */ |
|
| 112 | - protected $overridePriority = false; |
|
| 105 | + /** |
|
| 106 | + * If set to true, the message priority will always use the value defined |
|
| 107 | + * in {@link $priority}, otherwise the priority will be determined by the |
|
| 108 | + * message's log level. |
|
| 109 | + * |
|
| 110 | + * @var string |
|
| 111 | + */ |
|
| 112 | + protected $overridePriority = false; |
|
| 113 | 113 | |
| 114 | - /** |
|
| 115 | - * Holds the int value of the {@link $priority}. |
|
| 116 | - * @var int |
|
| 117 | - */ |
|
| 118 | - private $intPriority; |
|
| 114 | + /** |
|
| 115 | + * Holds the int value of the {@link $priority}. |
|
| 116 | + * @var int |
|
| 117 | + */ |
|
| 118 | + private $intPriority; |
|
| 119 | 119 | |
| 120 | - /** |
|
| 121 | - * Holds the int value of the {@link $facility}. |
|
| 122 | - * @var int |
|
| 123 | - */ |
|
| 124 | - private $intFacility; |
|
| 120 | + /** |
|
| 121 | + * Holds the int value of the {@link $facility}. |
|
| 122 | + * @var int |
|
| 123 | + */ |
|
| 124 | + private $intFacility; |
|
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * Holds the int value of the {@link $option}. |
|
| 128 | - * @var int |
|
| 129 | - */ |
|
| 130 | - private $intOption; |
|
| 126 | + /** |
|
| 127 | + * Holds the int value of the {@link $option}. |
|
| 128 | + * @var int |
|
| 129 | + */ |
|
| 130 | + private $intOption; |
|
| 131 | 131 | |
| 132 | - /** |
|
| 133 | - * Sets the {@link $ident}. |
|
| 134 | - * |
|
| 135 | - * @param string $ident |
|
| 136 | - */ |
|
| 137 | - public function setIdent($ident) { |
|
| 138 | - $this->ident = $ident; |
|
| 139 | - } |
|
| 132 | + /** |
|
| 133 | + * Sets the {@link $ident}. |
|
| 134 | + * |
|
| 135 | + * @param string $ident |
|
| 136 | + */ |
|
| 137 | + public function setIdent($ident) { |
|
| 138 | + $this->ident = $ident; |
|
| 139 | + } |
|
| 140 | 140 | |
| 141 | - /** |
|
| 142 | - * Sets the {@link $priority}. |
|
| 143 | - * |
|
| 144 | - * @param string $priority |
|
| 145 | - */ |
|
| 146 | - public function setPriority($priority) { |
|
| 147 | - $this->priority = $priority; |
|
| 148 | - } |
|
| 141 | + /** |
|
| 142 | + * Sets the {@link $priority}. |
|
| 143 | + * |
|
| 144 | + * @param string $priority |
|
| 145 | + */ |
|
| 146 | + public function setPriority($priority) { |
|
| 147 | + $this->priority = $priority; |
|
| 148 | + } |
|
| 149 | 149 | |
| 150 | - /** |
|
| 151 | - * Sets the {@link $facility}. |
|
| 152 | - * |
|
| 153 | - * @param string $facility |
|
| 154 | - */ |
|
| 155 | - public function setFacility($facility) { |
|
| 156 | - $this->facility = $facility; |
|
| 157 | - } |
|
| 150 | + /** |
|
| 151 | + * Sets the {@link $facility}. |
|
| 152 | + * |
|
| 153 | + * @param string $facility |
|
| 154 | + */ |
|
| 155 | + public function setFacility($facility) { |
|
| 156 | + $this->facility = $facility; |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - /** |
|
| 160 | - * Sets the {@link $overridePriority}. |
|
| 161 | - * |
|
| 162 | - * @param string $overridePriority |
|
| 163 | - */ |
|
| 164 | - public function setOverridePriority($overridePriority) { |
|
| 165 | - $this->overridePriority = $overridePriority; |
|
| 166 | - } |
|
| 159 | + /** |
|
| 160 | + * Sets the {@link $overridePriority}. |
|
| 161 | + * |
|
| 162 | + * @param string $overridePriority |
|
| 163 | + */ |
|
| 164 | + public function setOverridePriority($overridePriority) { |
|
| 165 | + $this->overridePriority = $overridePriority; |
|
| 166 | + } |
|
| 167 | 167 | |
| 168 | - /** |
|
| 169 | - * Sets the {@link $option}. |
|
| 170 | - * |
|
| 171 | - * @param string $option |
|
| 172 | - */ |
|
| 173 | - public function setOption($option) { |
|
| 174 | - $this->option = $option; |
|
| 175 | - } |
|
| 168 | + /** |
|
| 169 | + * Sets the {@link $option}. |
|
| 170 | + * |
|
| 171 | + * @param string $option |
|
| 172 | + */ |
|
| 173 | + public function setOption($option) { |
|
| 174 | + $this->option = $option; |
|
| 175 | + } |
|
| 176 | 176 | |
| 177 | - /** |
|
| 178 | - * Returns the {@link $ident}. |
|
| 179 | - * |
|
| 180 | - * @return string $ident |
|
| 181 | - */ |
|
| 182 | - public function getIdent() { |
|
| 183 | - return $this->ident; |
|
| 184 | - } |
|
| 177 | + /** |
|
| 178 | + * Returns the {@link $ident}. |
|
| 179 | + * |
|
| 180 | + * @return string $ident |
|
| 181 | + */ |
|
| 182 | + public function getIdent() { |
|
| 183 | + return $this->ident; |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | - /** |
|
| 187 | - * Returns the {@link $priority}. |
|
| 188 | - * |
|
| 189 | - * @return string |
|
| 190 | - */ |
|
| 191 | - public function getPriority() { |
|
| 192 | - return $this->priority; |
|
| 193 | - } |
|
| 186 | + /** |
|
| 187 | + * Returns the {@link $priority}. |
|
| 188 | + * |
|
| 189 | + * @return string |
|
| 190 | + */ |
|
| 191 | + public function getPriority() { |
|
| 192 | + return $this->priority; |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | - /** |
|
| 196 | - * Returns the {@link $facility}. |
|
| 197 | - * |
|
| 198 | - * @return string |
|
| 199 | - */ |
|
| 200 | - public function getFacility() { |
|
| 201 | - return $this->facility; |
|
| 202 | - } |
|
| 195 | + /** |
|
| 196 | + * Returns the {@link $facility}. |
|
| 197 | + * |
|
| 198 | + * @return string |
|
| 199 | + */ |
|
| 200 | + public function getFacility() { |
|
| 201 | + return $this->facility; |
|
| 202 | + } |
|
| 203 | 203 | |
| 204 | - /** |
|
| 205 | - * Returns the {@link $overridePriority}. |
|
| 206 | - * |
|
| 207 | - * @return string |
|
| 208 | - */ |
|
| 209 | - public function getOverridePriority() { |
|
| 210 | - return $this->overridePriority; |
|
| 211 | - } |
|
| 204 | + /** |
|
| 205 | + * Returns the {@link $overridePriority}. |
|
| 206 | + * |
|
| 207 | + * @return string |
|
| 208 | + */ |
|
| 209 | + public function getOverridePriority() { |
|
| 210 | + return $this->overridePriority; |
|
| 211 | + } |
|
| 212 | 212 | |
| 213 | - /** |
|
| 214 | - * Returns the {@link $option}. |
|
| 215 | - * |
|
| 216 | - * @return string |
|
| 217 | - */ |
|
| 218 | - public function getOption() { |
|
| 219 | - return $this->option; |
|
| 220 | - } |
|
| 213 | + /** |
|
| 214 | + * Returns the {@link $option}. |
|
| 215 | + * |
|
| 216 | + * @return string |
|
| 217 | + */ |
|
| 218 | + public function getOption() { |
|
| 219 | + return $this->option; |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | 222 | |
| 223 | - public function activateOptions() { |
|
| 224 | - $this->intPriority = $this->parsePriority(); |
|
| 225 | - $this->intOption = $this->parseOption(); |
|
| 226 | - $this->intFacility = $this->parseFacility(); |
|
| 223 | + public function activateOptions() { |
|
| 224 | + $this->intPriority = $this->parsePriority(); |
|
| 225 | + $this->intOption = $this->parseOption(); |
|
| 226 | + $this->intFacility = $this->parseFacility(); |
|
| 227 | 227 | |
| 228 | - $this->closed = false; |
|
| 229 | - } |
|
| 228 | + $this->closed = false; |
|
| 229 | + } |
|
| 230 | 230 | |
| 231 | - public function close() { |
|
| 232 | - if($this->closed != true) { |
|
| 233 | - closelog(); |
|
| 234 | - $this->closed = true; |
|
| 235 | - } |
|
| 236 | - } |
|
| 231 | + public function close() { |
|
| 232 | + if($this->closed != true) { |
|
| 233 | + closelog(); |
|
| 234 | + $this->closed = true; |
|
| 235 | + } |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | - /** |
|
| 239 | - * Appends the event to syslog. |
|
| 240 | - * |
|
| 241 | - * Log is opened and closed each time because if it is not closed, it |
|
| 242 | - * can cause the Apache httpd server to log to whatever ident/facility |
|
| 243 | - * was used in openlog(). |
|
| 244 | - * |
|
| 245 | - * @see http://www.php.net/manual/en/function.syslog.php#97843 |
|
| 246 | - */ |
|
| 247 | - public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 248 | - $priority = $this->getSyslogPriority($event->getLevel()); |
|
| 249 | - $message = $this->layout->format($event); |
|
| 238 | + /** |
|
| 239 | + * Appends the event to syslog. |
|
| 240 | + * |
|
| 241 | + * Log is opened and closed each time because if it is not closed, it |
|
| 242 | + * can cause the Apache httpd server to log to whatever ident/facility |
|
| 243 | + * was used in openlog(). |
|
| 244 | + * |
|
| 245 | + * @see http://www.php.net/manual/en/function.syslog.php#97843 |
|
| 246 | + */ |
|
| 247 | + public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 248 | + $priority = $this->getSyslogPriority($event->getLevel()); |
|
| 249 | + $message = $this->layout->format($event); |
|
| 250 | 250 | |
| 251 | - openlog($this->ident, $this->intOption, $this->intFacility); |
|
| 252 | - syslog($priority, $message); |
|
| 253 | - closelog(); |
|
| 254 | - } |
|
| 251 | + openlog($this->ident, $this->intOption, $this->intFacility); |
|
| 252 | + syslog($priority, $message); |
|
| 253 | + closelog(); |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | - /** Determines which syslog priority to use based on the given level. */ |
|
| 257 | - private function getSyslogPriority(Payone_Log4php_LoggerLevel $level) { |
|
| 258 | - if($this->overridePriority) { |
|
| 259 | - return $this->intPriority; |
|
| 260 | - } |
|
| 261 | - return $level->getSyslogEquivalent(); |
|
| 262 | - } |
|
| 256 | + /** Determines which syslog priority to use based on the given level. */ |
|
| 257 | + private function getSyslogPriority(Payone_Log4php_LoggerLevel $level) { |
|
| 258 | + if($this->overridePriority) { |
|
| 259 | + return $this->intPriority; |
|
| 260 | + } |
|
| 261 | + return $level->getSyslogEquivalent(); |
|
| 262 | + } |
|
| 263 | 263 | |
| 264 | - /** Parses a syslog option string and returns the correspodning int value. */ |
|
| 265 | - private function parseOption() { |
|
| 266 | - $value = 0; |
|
| 267 | - $options = explode('|', $this->option); |
|
| 264 | + /** Parses a syslog option string and returns the correspodning int value. */ |
|
| 265 | + private function parseOption() { |
|
| 266 | + $value = 0; |
|
| 267 | + $options = explode('|', $this->option); |
|
| 268 | 268 | |
| 269 | - foreach($options as $option) { |
|
| 270 | - if (!empty($option)) { |
|
| 271 | - $constant = "LOG_" . trim($option); |
|
| 272 | - if (defined($constant)) { |
|
| 273 | - $value |= constant($constant); |
|
| 274 | - } else { |
|
| 275 | - trigger_error("log4php: Invalid syslog option provided: $option. Whole option string: {$this->option}.", E_USER_WARNING); |
|
| 276 | - } |
|
| 277 | - } |
|
| 278 | - } |
|
| 279 | - return $value; |
|
| 280 | - } |
|
| 269 | + foreach($options as $option) { |
|
| 270 | + if (!empty($option)) { |
|
| 271 | + $constant = "LOG_" . trim($option); |
|
| 272 | + if (defined($constant)) { |
|
| 273 | + $value |= constant($constant); |
|
| 274 | + } else { |
|
| 275 | + trigger_error("log4php: Invalid syslog option provided: $option. Whole option string: {$this->option}.", E_USER_WARNING); |
|
| 276 | + } |
|
| 277 | + } |
|
| 278 | + } |
|
| 279 | + return $value; |
|
| 280 | + } |
|
| 281 | 281 | |
| 282 | - /** Parses the facility string and returns the corresponding int value. */ |
|
| 283 | - private function parseFacility() { |
|
| 284 | - if (!empty($this->facility)) { |
|
| 285 | - $constant = "LOG_" . trim($this->facility); |
|
| 286 | - if (defined($constant)) { |
|
| 287 | - return constant($constant); |
|
| 288 | - } else { |
|
| 289 | - trigger_error("log4php: Invalid syslog facility provided: {$this->facility}.", E_USER_WARNING); |
|
| 290 | - } |
|
| 291 | - } |
|
| 292 | - } |
|
| 282 | + /** Parses the facility string and returns the corresponding int value. */ |
|
| 283 | + private function parseFacility() { |
|
| 284 | + if (!empty($this->facility)) { |
|
| 285 | + $constant = "LOG_" . trim($this->facility); |
|
| 286 | + if (defined($constant)) { |
|
| 287 | + return constant($constant); |
|
| 288 | + } else { |
|
| 289 | + trigger_error("log4php: Invalid syslog facility provided: {$this->facility}.", E_USER_WARNING); |
|
| 290 | + } |
|
| 291 | + } |
|
| 292 | + } |
|
| 293 | 293 | |
| 294 | - /** Parses the priority string and returns the corresponding int value. */ |
|
| 295 | - private function parsePriority() { |
|
| 296 | - if (!empty($this->priority)) { |
|
| 297 | - $constant = "LOG_" . trim($this->priority); |
|
| 298 | - if (defined($constant)) { |
|
| 299 | - return constant($constant); |
|
| 300 | - } else { |
|
| 301 | - trigger_error("log4php: Invalid syslog priority provided: {$this->priority}.", E_USER_WARNING); |
|
| 302 | - } |
|
| 303 | - } |
|
| 304 | - } |
|
| 294 | + /** Parses the priority string and returns the corresponding int value. */ |
|
| 295 | + private function parsePriority() { |
|
| 296 | + if (!empty($this->priority)) { |
|
| 297 | + $constant = "LOG_" . trim($this->priority); |
|
| 298 | + if (defined($constant)) { |
|
| 299 | + return constant($constant); |
|
| 300 | + } else { |
|
| 301 | + trigger_error("log4php: Invalid syslog priority provided: {$this->priority}.", E_USER_WARNING); |
|
| 302 | + } |
|
| 303 | + } |
|
| 304 | + } |
|
| 305 | 305 | } |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | public function close() { |
| 232 | - if($this->closed != true) { |
|
| 232 | + if ($this->closed != true) { |
|
| 233 | 233 | closelog(); |
| 234 | 234 | $this->closed = true; |
| 235 | 235 | } |
@@ -255,7 +255,7 @@ discard block |
||
| 255 | 255 | |
| 256 | 256 | /** Determines which syslog priority to use based on the given level. */ |
| 257 | 257 | private function getSyslogPriority(Payone_Log4php_LoggerLevel $level) { |
| 258 | - if($this->overridePriority) { |
|
| 258 | + if ($this->overridePriority) { |
|
| 259 | 259 | return $this->intPriority; |
| 260 | 260 | } |
| 261 | 261 | return $level->getSyslogEquivalent(); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | $value = 0; |
| 267 | 267 | $options = explode('|', $this->option); |
| 268 | 268 | |
| 269 | - foreach($options as $option) { |
|
| 269 | + foreach ($options as $option) { |
|
| 270 | 270 | if (!empty($option)) { |
| 271 | 271 | $constant = "LOG_" . trim($option); |
| 272 | 272 | if (defined($constant)) { |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | if (function_exists('__autoload')) { |
| 22 | - //trigger_error("log4php: It looks like your code is using an __autoload() function. log4php uses spl_autoload_register() which will bypass your __autoload() function and may break autoloading.", E_USER_WARNING); |
|
| 22 | + //trigger_error("log4php: It looks like your code is using an __autoload() function. log4php uses spl_autoload_register() which will bypass your __autoload() function and may break autoloading.", E_USER_WARNING); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | spl_autoload_register(array('Payone_Log4php_LoggerAutoloader', 'autoload')); |
@@ -33,108 +33,108 @@ discard block |
||
| 33 | 33 | */ |
| 34 | 34 | class Payone_Log4php_LoggerAutoloader { |
| 35 | 35 | |
| 36 | - /** Maps classnames to files containing the class. */ |
|
| 37 | - private static $classes = array( |
|
| 36 | + /** Maps classnames to files containing the class. */ |
|
| 37 | + private static $classes = array( |
|
| 38 | 38 | |
| 39 | - // Base |
|
| 40 | - 'Payone_Log4php_LoggerAppender' => '/LoggerAppender.php', |
|
| 41 | - 'Payone_Log4php_LoggerAppenderPool' => '/LoggerAppenderPool.php', |
|
| 42 | - 'Payone_Log4php_LoggerConfigurable' => '/LoggerConfigurable.php', |
|
| 43 | - 'Payone_Log4php_LoggerConfigurator' => '/LoggerConfigurator.php', |
|
| 44 | - 'Payone_Log4php_LoggerException' => '/LoggerException.php', |
|
| 45 | - 'Payone_Log4php_LoggerFilter' => '/LoggerFilter.php', |
|
| 46 | - 'Payone_Log4php_LoggerHierarchy' => '/LoggerHierarchy.php', |
|
| 47 | - 'Payone_Log4php_LoggerLevel' => '/LoggerLevel.php', |
|
| 48 | - 'Payone_Log4php_LoggerLocationInfo' => '/LoggerLocationInfo.php', |
|
| 49 | - 'Payone_Log4php_LoggerLoggingEvent' => '/LoggerLoggingEvent.php', |
|
| 50 | - 'Payone_Log4php_LoggerMDC' => '/LoggerMDC.php', |
|
| 51 | - 'Payone_Log4php_LoggerNDC' => '/LoggerNDC.php', |
|
| 52 | - 'Payone_Log4php_LoggerLayout' => '/LoggerLayout.php', |
|
| 53 | - 'Payone_Log4php_LoggerReflectionUtils' => '/LoggerReflectionUtils.php', |
|
| 54 | - 'Payone_Log4php_LoggerRoot' => '/LoggerRoot.php', |
|
| 55 | - 'Payone_Log4php_LoggerThrowableInformation' => '/LoggerThrowableInformation.php', |
|
| 39 | + // Base |
|
| 40 | + 'Payone_Log4php_LoggerAppender' => '/LoggerAppender.php', |
|
| 41 | + 'Payone_Log4php_LoggerAppenderPool' => '/LoggerAppenderPool.php', |
|
| 42 | + 'Payone_Log4php_LoggerConfigurable' => '/LoggerConfigurable.php', |
|
| 43 | + 'Payone_Log4php_LoggerConfigurator' => '/LoggerConfigurator.php', |
|
| 44 | + 'Payone_Log4php_LoggerException' => '/LoggerException.php', |
|
| 45 | + 'Payone_Log4php_LoggerFilter' => '/LoggerFilter.php', |
|
| 46 | + 'Payone_Log4php_LoggerHierarchy' => '/LoggerHierarchy.php', |
|
| 47 | + 'Payone_Log4php_LoggerLevel' => '/LoggerLevel.php', |
|
| 48 | + 'Payone_Log4php_LoggerLocationInfo' => '/LoggerLocationInfo.php', |
|
| 49 | + 'Payone_Log4php_LoggerLoggingEvent' => '/LoggerLoggingEvent.php', |
|
| 50 | + 'Payone_Log4php_LoggerMDC' => '/LoggerMDC.php', |
|
| 51 | + 'Payone_Log4php_LoggerNDC' => '/LoggerNDC.php', |
|
| 52 | + 'Payone_Log4php_LoggerLayout' => '/LoggerLayout.php', |
|
| 53 | + 'Payone_Log4php_LoggerReflectionUtils' => '/LoggerReflectionUtils.php', |
|
| 54 | + 'Payone_Log4php_LoggerRoot' => '/LoggerRoot.php', |
|
| 55 | + 'Payone_Log4php_LoggerThrowableInformation' => '/LoggerThrowableInformation.php', |
|
| 56 | 56 | |
| 57 | - // Appenders |
|
| 58 | - 'Payone_Log4php_LoggerAppenderConsole' => '/LoggerAppenderConsole.php', |
|
| 59 | - 'Payone_Log4php_LoggerAppenderDailyFile' => '/LoggerAppenderDailyFile.php', |
|
| 60 | - 'Payone_Log4php_LoggerAppenderEcho' => '/LoggerAppenderEcho.php', |
|
| 61 | - 'Payone_Log4php_LoggerAppenderFile' => '/LoggerAppenderFile.php', |
|
| 62 | - 'Payone_Log4php_LoggerAppenderMail' => '/LoggerAppenderMail.php', |
|
| 63 | - 'Payone_Log4php_LoggerAppenderMailEvent' => '/LoggerAppenderMailEvent.php', |
|
| 64 | - 'Payone_Log4php_LoggerAppenderMongoDB' => '/LoggerAppenderMongoDB.php', |
|
| 65 | - 'Payone_Log4php_LoggerAppenderNull' => '/LoggerAppenderNull.php', |
|
| 66 | - 'Payone_Log4php_LoggerAppenderPDO' => '/LoggerAppenderPDO.php', |
|
| 67 | - 'Payone_Log4php_LoggerAppenderPhp' => '/LoggerAppenderPhp.php', |
|
| 68 | - 'Payone_Log4php_LoggerAppenderRollingFile' => '/LoggerAppenderRollingFile.php', |
|
| 69 | - 'Payone_Log4php_LoggerAppenderSocket' => '/LoggerAppenderSocket.php', |
|
| 70 | - 'Payone_Log4php_LoggerAppenderSyslog' => '/LoggerAppenderSyslog.php', |
|
| 57 | + // Appenders |
|
| 58 | + 'Payone_Log4php_LoggerAppenderConsole' => '/LoggerAppenderConsole.php', |
|
| 59 | + 'Payone_Log4php_LoggerAppenderDailyFile' => '/LoggerAppenderDailyFile.php', |
|
| 60 | + 'Payone_Log4php_LoggerAppenderEcho' => '/LoggerAppenderEcho.php', |
|
| 61 | + 'Payone_Log4php_LoggerAppenderFile' => '/LoggerAppenderFile.php', |
|
| 62 | + 'Payone_Log4php_LoggerAppenderMail' => '/LoggerAppenderMail.php', |
|
| 63 | + 'Payone_Log4php_LoggerAppenderMailEvent' => '/LoggerAppenderMailEvent.php', |
|
| 64 | + 'Payone_Log4php_LoggerAppenderMongoDB' => '/LoggerAppenderMongoDB.php', |
|
| 65 | + 'Payone_Log4php_LoggerAppenderNull' => '/LoggerAppenderNull.php', |
|
| 66 | + 'Payone_Log4php_LoggerAppenderPDO' => '/LoggerAppenderPDO.php', |
|
| 67 | + 'Payone_Log4php_LoggerAppenderPhp' => '/LoggerAppenderPhp.php', |
|
| 68 | + 'Payone_Log4php_LoggerAppenderRollingFile' => '/LoggerAppenderRollingFile.php', |
|
| 69 | + 'Payone_Log4php_LoggerAppenderSocket' => '/LoggerAppenderSocket.php', |
|
| 70 | + 'Payone_Log4php_LoggerAppenderSyslog' => '/LoggerAppenderSyslog.php', |
|
| 71 | 71 | |
| 72 | - // Configurators |
|
| 73 | - 'Payone_Log4php_LoggerConfigurationAdapter' => '/LoggerConfigurationAdapter.php', |
|
| 74 | - 'Payone_Log4php_LoggerConfigurationAdapterINI' => '/LoggerConfigurationAdapterINI.php', |
|
| 75 | - 'Payone_Log4php_LoggerConfigurationAdapterPHP' => '/LoggerConfigurationAdapterPHP.php', |
|
| 76 | - 'Payone_Log4php_LoggerConfigurationAdapterXML' => '/LoggerConfigurationAdapterXML.php', |
|
| 77 | - 'Payone_Log4php_LoggerConfiguratorDefault' => '/LoggerConfiguratorDefault.php', |
|
| 72 | + // Configurators |
|
| 73 | + 'Payone_Log4php_LoggerConfigurationAdapter' => '/LoggerConfigurationAdapter.php', |
|
| 74 | + 'Payone_Log4php_LoggerConfigurationAdapterINI' => '/LoggerConfigurationAdapterINI.php', |
|
| 75 | + 'Payone_Log4php_LoggerConfigurationAdapterPHP' => '/LoggerConfigurationAdapterPHP.php', |
|
| 76 | + 'Payone_Log4php_LoggerConfigurationAdapterXML' => '/LoggerConfigurationAdapterXML.php', |
|
| 77 | + 'Payone_Log4php_LoggerConfiguratorDefault' => '/LoggerConfiguratorDefault.php', |
|
| 78 | 78 | |
| 79 | - // Filters |
|
| 80 | - 'Payone_Log4php_LoggerFilterDenyAll' => '/LoggerFilterDenyAll.php', |
|
| 81 | - 'Payone_Log4php_LoggerFilterLevelMatch' => '/LoggerFilterLevelMatch.php', |
|
| 82 | - 'Payone_Log4php_LoggerFilterLevelRange' => '/LoggerFilterLevelRange.php', |
|
| 83 | - 'Payone_Log4php_LoggerFilterStringMatch' => '/LoggerFilterStringMatch.php', |
|
| 79 | + // Filters |
|
| 80 | + 'Payone_Log4php_LoggerFilterDenyAll' => '/LoggerFilterDenyAll.php', |
|
| 81 | + 'Payone_Log4php_LoggerFilterLevelMatch' => '/LoggerFilterLevelMatch.php', |
|
| 82 | + 'Payone_Log4php_LoggerFilterLevelRange' => '/LoggerFilterLevelRange.php', |
|
| 83 | + 'Payone_Log4php_LoggerFilterStringMatch' => '/LoggerFilterStringMatch.php', |
|
| 84 | 84 | |
| 85 | - // Helpers |
|
| 86 | - 'Payone_Log4php_LoggerFormattingInfo' => '/LoggerFormattingInfo.php', |
|
| 87 | - 'Payone_Log4php_LoggerOptionConverter' => '/LoggerOptionConverter.php', |
|
| 88 | - 'Payone_Log4php_LoggerPatternParser' => '/LoggerPatternParser.php', |
|
| 89 | - 'Payone_Log4php_LoggerUtils' => '/LoggerUtils.php', |
|
| 85 | + // Helpers |
|
| 86 | + 'Payone_Log4php_LoggerFormattingInfo' => '/LoggerFormattingInfo.php', |
|
| 87 | + 'Payone_Log4php_LoggerOptionConverter' => '/LoggerOptionConverter.php', |
|
| 88 | + 'Payone_Log4php_LoggerPatternParser' => '/LoggerPatternParser.php', |
|
| 89 | + 'Payone_Log4php_LoggerUtils' => '/LoggerUtils.php', |
|
| 90 | 90 | |
| 91 | - // Pattern converters |
|
| 92 | - 'Payone_Log4php_LoggerPatternConverter' => '/LoggerPatternConverter.php', |
|
| 93 | - 'Payone_Log4php_LoggerPatternConverterClass' => '/LoggerPatternConverterClass.php', |
|
| 94 | - 'Payone_Log4php_LoggerPatternConverterCookie' => '/LoggerPatternConverterCookie.php', |
|
| 95 | - 'Payone_Log4php_LoggerPatternConverterDate' => '/LoggerPatternConverterDate.php', |
|
| 96 | - 'Payone_Log4php_LoggerPatternConverterEnvironment' => '/LoggerPatternConverterEnvironment.php', |
|
| 97 | - 'Payone_Log4php_LoggerPatternConverterFile' => '/LoggerPatternConverterFile.php', |
|
| 98 | - 'Payone_Log4php_LoggerPatternConverterLevel' => '/LoggerPatternConverterLevel.php', |
|
| 99 | - 'Payone_Log4php_LoggerPatternConverterLine' => '/LoggerPatternConverterLine.php', |
|
| 100 | - 'Payone_Log4php_LoggerPatternConverterLiteral' => '/LoggerPatternConverterLiteral.php', |
|
| 101 | - 'Payone_Log4php_LoggerPatternConverterLogger' => '/LoggerPatternConverterLogger.php', |
|
| 102 | - 'Payone_Log4php_LoggerPatternConverterMDC' => '/LoggerPatternConverterMDC.php', |
|
| 103 | - 'Payone_Log4php_LoggerPatternConverterMessage' => '/LoggerPatternConverterMessage.php', |
|
| 104 | - 'Payone_Log4php_LoggerPatternConverterMethod' => '/LoggerPatternConverterMethod.php', |
|
| 105 | - 'Payone_Log4php_LoggerPatternConverterNDC' => '/LoggerPatternConverterNDC.php', |
|
| 106 | - 'Payone_Log4php_LoggerPatternConverterNewLine' => '/LoggerPatternConverterNewLine.php', |
|
| 107 | - 'Payone_Log4php_LoggerPatternConverterProcess' => '/LoggerPatternConverterProcess.php', |
|
| 108 | - 'Payone_Log4php_LoggerPatternConverterRelative' => '/LoggerPatternConverterRelative.php', |
|
| 109 | - 'Payone_Log4php_LoggerPatternConverterRequest' => '/LoggerPatternConverterRequest.php', |
|
| 110 | - 'Payone_Log4php_LoggerPatternConverterServer' => '/LoggerPatternConverterServer.php', |
|
| 111 | - 'Payone_Log4php_LoggerPatternConverterSession' => '/LoggerPatternConverterSession.php', |
|
| 112 | - 'Payone_Log4php_LoggerPatternConverterSessionID' => '/LoggerPatternConverterSessionID.php', |
|
| 113 | - 'Payone_Log4php_LoggerPatternConverterSuperglobal' => '/LoggerPatternConverterSuperglobal.php', |
|
| 114 | - 'Payone_Log4php_LoggerPatternConverterThrowable' => '/LoggerPatternConverterThrowable.php', |
|
| 91 | + // Pattern converters |
|
| 92 | + 'Payone_Log4php_LoggerPatternConverter' => '/LoggerPatternConverter.php', |
|
| 93 | + 'Payone_Log4php_LoggerPatternConverterClass' => '/LoggerPatternConverterClass.php', |
|
| 94 | + 'Payone_Log4php_LoggerPatternConverterCookie' => '/LoggerPatternConverterCookie.php', |
|
| 95 | + 'Payone_Log4php_LoggerPatternConverterDate' => '/LoggerPatternConverterDate.php', |
|
| 96 | + 'Payone_Log4php_LoggerPatternConverterEnvironment' => '/LoggerPatternConverterEnvironment.php', |
|
| 97 | + 'Payone_Log4php_LoggerPatternConverterFile' => '/LoggerPatternConverterFile.php', |
|
| 98 | + 'Payone_Log4php_LoggerPatternConverterLevel' => '/LoggerPatternConverterLevel.php', |
|
| 99 | + 'Payone_Log4php_LoggerPatternConverterLine' => '/LoggerPatternConverterLine.php', |
|
| 100 | + 'Payone_Log4php_LoggerPatternConverterLiteral' => '/LoggerPatternConverterLiteral.php', |
|
| 101 | + 'Payone_Log4php_LoggerPatternConverterLogger' => '/LoggerPatternConverterLogger.php', |
|
| 102 | + 'Payone_Log4php_LoggerPatternConverterMDC' => '/LoggerPatternConverterMDC.php', |
|
| 103 | + 'Payone_Log4php_LoggerPatternConverterMessage' => '/LoggerPatternConverterMessage.php', |
|
| 104 | + 'Payone_Log4php_LoggerPatternConverterMethod' => '/LoggerPatternConverterMethod.php', |
|
| 105 | + 'Payone_Log4php_LoggerPatternConverterNDC' => '/LoggerPatternConverterNDC.php', |
|
| 106 | + 'Payone_Log4php_LoggerPatternConverterNewLine' => '/LoggerPatternConverterNewLine.php', |
|
| 107 | + 'Payone_Log4php_LoggerPatternConverterProcess' => '/LoggerPatternConverterProcess.php', |
|
| 108 | + 'Payone_Log4php_LoggerPatternConverterRelative' => '/LoggerPatternConverterRelative.php', |
|
| 109 | + 'Payone_Log4php_LoggerPatternConverterRequest' => '/LoggerPatternConverterRequest.php', |
|
| 110 | + 'Payone_Log4php_LoggerPatternConverterServer' => '/LoggerPatternConverterServer.php', |
|
| 111 | + 'Payone_Log4php_LoggerPatternConverterSession' => '/LoggerPatternConverterSession.php', |
|
| 112 | + 'Payone_Log4php_LoggerPatternConverterSessionID' => '/LoggerPatternConverterSessionID.php', |
|
| 113 | + 'Payone_Log4php_LoggerPatternConverterSuperglobal' => '/LoggerPatternConverterSuperglobal.php', |
|
| 114 | + 'Payone_Log4php_LoggerPatternConverterThrowable' => '/LoggerPatternConverterThrowable.php', |
|
| 115 | 115 | |
| 116 | - // Layouts |
|
| 117 | - 'Payone_Log4php_LoggerLayoutHtml' => '/LoggerLayoutHtml.php', |
|
| 118 | - 'Payone_Log4php_LoggerLayoutPattern' => '/LoggerLayoutPattern.php', |
|
| 119 | - 'Payone_Log4php_LoggerLayoutSerialized' => '/LoggerLayoutSerialized.php', |
|
| 120 | - 'Payone_Log4php_LoggerLayoutSimple' => '/LoggerLayoutSimple.php', |
|
| 121 | - 'Payone_Log4php_LoggerLayoutTTCC' => '/LoggerLayoutTTCC.php', |
|
| 122 | - 'Payone_Log4php_LoggerLayoutXml' => '/LoggerLayoutXml.php', |
|
| 116 | + // Layouts |
|
| 117 | + 'Payone_Log4php_LoggerLayoutHtml' => '/LoggerLayoutHtml.php', |
|
| 118 | + 'Payone_Log4php_LoggerLayoutPattern' => '/LoggerLayoutPattern.php', |
|
| 119 | + 'Payone_Log4php_LoggerLayoutSerialized' => '/LoggerLayoutSerialized.php', |
|
| 120 | + 'Payone_Log4php_LoggerLayoutSimple' => '/LoggerLayoutSimple.php', |
|
| 121 | + 'Payone_Log4php_LoggerLayoutTTCC' => '/LoggerLayoutTTCC.php', |
|
| 122 | + 'Payone_Log4php_LoggerLayoutXml' => '/LoggerLayoutXml.php', |
|
| 123 | 123 | |
| 124 | - // Renderers |
|
| 125 | - 'Payone_Log4php_LoggerRendererDefault' => '/LoggerRendererDefault.php', |
|
| 126 | - 'Payone_Log4php_LoggerRendererException' => '/LoggerRendererException.php', |
|
| 127 | - 'Payone_Log4php_LoggerRendererMap' => '/LoggerRendererMap.php', |
|
| 128 | - 'Payone_Log4php_LoggerRendererObject' => '/LoggerRendererObject.php', |
|
| 129 | - ); |
|
| 124 | + // Renderers |
|
| 125 | + 'Payone_Log4php_LoggerRendererDefault' => '/LoggerRendererDefault.php', |
|
| 126 | + 'Payone_Log4php_LoggerRendererException' => '/LoggerRendererException.php', |
|
| 127 | + 'Payone_Log4php_LoggerRendererMap' => '/LoggerRendererMap.php', |
|
| 128 | + 'Payone_Log4php_LoggerRendererObject' => '/LoggerRendererObject.php', |
|
| 129 | + ); |
|
| 130 | 130 | |
| 131 | - /** |
|
| 132 | - * Loads a class. |
|
| 133 | - * @param string $className The name of the class to load. |
|
| 134 | - */ |
|
| 135 | - public static function autoload($className) { |
|
| 136 | - if(isset(self::$classes[$className])) { |
|
| 137 | - require_once dirname(__FILE__) . self::$classes[$className]; |
|
| 138 | - } |
|
| 139 | - } |
|
| 131 | + /** |
|
| 132 | + * Loads a class. |
|
| 133 | + * @param string $className The name of the class to load. |
|
| 134 | + */ |
|
| 135 | + public static function autoload($className) { |
|
| 136 | + if(isset(self::$classes[$className])) { |
|
| 137 | + require_once dirname(__FILE__) . self::$classes[$className]; |
|
| 138 | + } |
|
| 139 | + } |
|
| 140 | 140 | } |
@@ -133,7 +133,7 @@ |
||
| 133 | 133 | * @param string $className The name of the class to load. |
| 134 | 134 | */ |
| 135 | 135 | public static function autoload($className) { |
| 136 | - if(isset(self::$classes[$className])) { |
|
| 136 | + if (isset(self::$classes[$className])) { |
|
| 137 | 137 | require_once dirname(__FILE__) . self::$classes[$className]; |
| 138 | 138 | } |
| 139 | 139 | } |
@@ -54,157 +54,157 @@ |
||
| 54 | 54 | * @subpackage layouts |
| 55 | 55 | */ |
| 56 | 56 | class Payone_Log4php_LoggerLayoutXml extends Payone_Log4php_LoggerLayout { |
| 57 | - const LOG4J_NS_PREFIX ='log4j'; |
|
| 58 | - const LOG4J_NS = 'http://jakarta.apache.org/log4j/'; |
|
| 57 | + const LOG4J_NS_PREFIX ='log4j'; |
|
| 58 | + const LOG4J_NS = 'http://jakarta.apache.org/log4j/'; |
|
| 59 | 59 | |
| 60 | - const LOG4PHP_NS_PREFIX = 'log4php'; |
|
| 61 | - const LOG4PHP_NS = 'http://logging.apache.org/log4php/'; |
|
| 60 | + const LOG4PHP_NS_PREFIX = 'log4php'; |
|
| 61 | + const LOG4PHP_NS = 'http://logging.apache.org/log4php/'; |
|
| 62 | 62 | |
| 63 | - const CDATA_START = '<![CDATA['; |
|
| 64 | - const CDATA_END = ']]>'; |
|
| 65 | - const CDATA_PSEUDO_END = ']]>'; |
|
| 66 | - const CDATA_EMBEDDED_END = ']]>]]><![CDATA['; |
|
| 63 | + const CDATA_START = '<![CDATA['; |
|
| 64 | + const CDATA_END = ']]>'; |
|
| 65 | + const CDATA_PSEUDO_END = ']]>'; |
|
| 66 | + const CDATA_EMBEDDED_END = ']]>]]><![CDATA['; |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * If set to true then the file name and line number of the origin of the |
|
| 70 | - * log statement will be output. |
|
| 71 | - * @var boolean |
|
| 72 | - */ |
|
| 73 | - protected $locationInfo = true; |
|
| 68 | + /** |
|
| 69 | + * If set to true then the file name and line number of the origin of the |
|
| 70 | + * log statement will be output. |
|
| 71 | + * @var boolean |
|
| 72 | + */ |
|
| 73 | + protected $locationInfo = true; |
|
| 74 | 74 | |
| 75 | - /** |
|
| 76 | - * If set to true, log4j namespace will be used instead of the log4php |
|
| 77 | - * namespace. |
|
| 78 | - * @var boolean |
|
| 79 | - */ |
|
| 80 | - protected $log4jNamespace = false; |
|
| 75 | + /** |
|
| 76 | + * If set to true, log4j namespace will be used instead of the log4php |
|
| 77 | + * namespace. |
|
| 78 | + * @var boolean |
|
| 79 | + */ |
|
| 80 | + protected $log4jNamespace = false; |
|
| 81 | 81 | |
| 82 | - /** The namespace in use. */ |
|
| 83 | - protected $namespace = self::LOG4PHP_NS; |
|
| 82 | + /** The namespace in use. */ |
|
| 83 | + protected $namespace = self::LOG4PHP_NS; |
|
| 84 | 84 | |
| 85 | - /** The namespace prefix in use */ |
|
| 86 | - protected $namespacePrefix = self::LOG4PHP_NS_PREFIX; |
|
| 85 | + /** The namespace prefix in use */ |
|
| 86 | + protected $namespacePrefix = self::LOG4PHP_NS_PREFIX; |
|
| 87 | 87 | |
| 88 | - public function activateOptions() { |
|
| 89 | - if ($this->getLog4jNamespace()) { |
|
| 90 | - $this->namespace = self::LOG4J_NS; |
|
| 91 | - $this->namespacePrefix = self::LOG4J_NS_PREFIX; |
|
| 92 | - } else { |
|
| 93 | - $this->namespace = self::LOG4PHP_NS; |
|
| 94 | - $this->namespacePrefix = self::LOG4PHP_NS_PREFIX; |
|
| 95 | - } |
|
| 96 | - } |
|
| 88 | + public function activateOptions() { |
|
| 89 | + if ($this->getLog4jNamespace()) { |
|
| 90 | + $this->namespace = self::LOG4J_NS; |
|
| 91 | + $this->namespacePrefix = self::LOG4J_NS_PREFIX; |
|
| 92 | + } else { |
|
| 93 | + $this->namespace = self::LOG4PHP_NS; |
|
| 94 | + $this->namespacePrefix = self::LOG4PHP_NS_PREFIX; |
|
| 95 | + } |
|
| 96 | + } |
|
| 97 | 97 | |
| 98 | - /** |
|
| 99 | - * @return string |
|
| 100 | - */ |
|
| 101 | - public function getHeader() { |
|
| 102 | - return "<{$this->namespacePrefix}:eventSet ". |
|
| 103 | - "xmlns:{$this->namespacePrefix}=\"{$this->namespace}\" ". |
|
| 104 | - "version=\"0.3\" ". |
|
| 105 | - "includesLocationInfo=\"".($this->getLocationInfo() ? "true" : "false")."\"". |
|
| 106 | - ">" . PHP_EOL; |
|
| 107 | - } |
|
| 98 | + /** |
|
| 99 | + * @return string |
|
| 100 | + */ |
|
| 101 | + public function getHeader() { |
|
| 102 | + return "<{$this->namespacePrefix}:eventSet ". |
|
| 103 | + "xmlns:{$this->namespacePrefix}=\"{$this->namespace}\" ". |
|
| 104 | + "version=\"0.3\" ". |
|
| 105 | + "includesLocationInfo=\"".($this->getLocationInfo() ? "true" : "false")."\"". |
|
| 106 | + ">" . PHP_EOL; |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | - /** |
|
| 110 | - * Formats a {@link LoggerLoggingEvent} in conformance with the log4php.dtd. |
|
| 111 | - * |
|
| 112 | - * @param Payone_Log4php_LoggerLoggingEvent $event |
|
| 113 | - * @return string |
|
| 114 | - */ |
|
| 115 | - public function format(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 116 | - $ns = $this->namespacePrefix; |
|
| 109 | + /** |
|
| 110 | + * Formats a {@link LoggerLoggingEvent} in conformance with the log4php.dtd. |
|
| 111 | + * |
|
| 112 | + * @param Payone_Log4php_LoggerLoggingEvent $event |
|
| 113 | + * @return string |
|
| 114 | + */ |
|
| 115 | + public function format(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 116 | + $ns = $this->namespacePrefix; |
|
| 117 | 117 | |
| 118 | - $loggerName = $event->getLoggerName(); |
|
| 119 | - $timeStamp = number_format((float)($event->getTimeStamp() * 1000), 0, '', ''); |
|
| 120 | - $thread = $event->getThreadName(); |
|
| 121 | - $level = $event->getLevel()->toString(); |
|
| 118 | + $loggerName = $event->getLoggerName(); |
|
| 119 | + $timeStamp = number_format((float)($event->getTimeStamp() * 1000), 0, '', ''); |
|
| 120 | + $thread = $event->getThreadName(); |
|
| 121 | + $level = $event->getLevel()->toString(); |
|
| 122 | 122 | |
| 123 | - $buf = "<$ns:event logger=\"{$loggerName}\" level=\"{$level}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">".PHP_EOL; |
|
| 124 | - $buf .= "<$ns:message>"; |
|
| 125 | - $buf .= $this->encodeCDATA($event->getRenderedMessage()); |
|
| 126 | - $buf .= "</$ns:message>".PHP_EOL; |
|
| 123 | + $buf = "<$ns:event logger=\"{$loggerName}\" level=\"{$level}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">".PHP_EOL; |
|
| 124 | + $buf .= "<$ns:message>"; |
|
| 125 | + $buf .= $this->encodeCDATA($event->getRenderedMessage()); |
|
| 126 | + $buf .= "</$ns:message>".PHP_EOL; |
|
| 127 | 127 | |
| 128 | - $ndc = $event->getNDC(); |
|
| 129 | - if(!empty($ndc)) { |
|
| 130 | - $buf .= "<$ns:NDC><![CDATA["; |
|
| 131 | - $buf .= $this->encodeCDATA($ndc); |
|
| 132 | - $buf .= "]]></$ns:NDC>".PHP_EOL; |
|
| 133 | - } |
|
| 128 | + $ndc = $event->getNDC(); |
|
| 129 | + if(!empty($ndc)) { |
|
| 130 | + $buf .= "<$ns:NDC><![CDATA["; |
|
| 131 | + $buf .= $this->encodeCDATA($ndc); |
|
| 132 | + $buf .= "]]></$ns:NDC>".PHP_EOL; |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - $mdcMap = $event->getMDCMap(); |
|
| 136 | - if (!empty($mdcMap)) { |
|
| 137 | - $buf .= "<$ns:properties>".PHP_EOL; |
|
| 138 | - foreach ($mdcMap as $name=>$value) { |
|
| 139 | - $buf .= "<$ns:data name=\"$name\" value=\"$value\" />".PHP_EOL; |
|
| 140 | - } |
|
| 141 | - $buf .= "</$ns:properties>".PHP_EOL; |
|
| 142 | - } |
|
| 135 | + $mdcMap = $event->getMDCMap(); |
|
| 136 | + if (!empty($mdcMap)) { |
|
| 137 | + $buf .= "<$ns:properties>".PHP_EOL; |
|
| 138 | + foreach ($mdcMap as $name=>$value) { |
|
| 139 | + $buf .= "<$ns:data name=\"$name\" value=\"$value\" />".PHP_EOL; |
|
| 140 | + } |
|
| 141 | + $buf .= "</$ns:properties>".PHP_EOL; |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - if ($this->getLocationInfo()) { |
|
| 145 | - $locationInfo = $event->getLocationInformation(); |
|
| 146 | - $buf .= "<$ns:locationInfo ". |
|
| 147 | - "class=\"" . $locationInfo->getClassName() . "\" ". |
|
| 148 | - "file=\"" . htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" ". |
|
| 149 | - "line=\"" . $locationInfo->getLineNumber() . "\" ". |
|
| 150 | - "method=\"" . $locationInfo->getMethodName() . "\" "; |
|
| 151 | - $buf .= "/>".PHP_EOL; |
|
| 152 | - } |
|
| 144 | + if ($this->getLocationInfo()) { |
|
| 145 | + $locationInfo = $event->getLocationInformation(); |
|
| 146 | + $buf .= "<$ns:locationInfo ". |
|
| 147 | + "class=\"" . $locationInfo->getClassName() . "\" ". |
|
| 148 | + "file=\"" . htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" ". |
|
| 149 | + "line=\"" . $locationInfo->getLineNumber() . "\" ". |
|
| 150 | + "method=\"" . $locationInfo->getMethodName() . "\" "; |
|
| 151 | + $buf .= "/>".PHP_EOL; |
|
| 152 | + } |
|
| 153 | 153 | |
| 154 | - $buf .= "</$ns:event>".PHP_EOL; |
|
| 154 | + $buf .= "</$ns:event>".PHP_EOL; |
|
| 155 | 155 | |
| 156 | - return $buf; |
|
| 157 | - } |
|
| 156 | + return $buf; |
|
| 157 | + } |
|
| 158 | 158 | |
| 159 | - /** |
|
| 160 | - * @return string |
|
| 161 | - */ |
|
| 162 | - public function getFooter() { |
|
| 163 | - return "</{$this->namespacePrefix}:eventSet>" . PHP_EOL; |
|
| 164 | - } |
|
| 159 | + /** |
|
| 160 | + * @return string |
|
| 161 | + */ |
|
| 162 | + public function getFooter() { |
|
| 163 | + return "</{$this->namespacePrefix}:eventSet>" . PHP_EOL; |
|
| 164 | + } |
|
| 165 | 165 | |
| 166 | 166 | |
| 167 | - /** |
|
| 168 | - * Whether or not file name and line number will be included in the output. |
|
| 169 | - * @return boolean |
|
| 170 | - */ |
|
| 171 | - public function getLocationInfo() { |
|
| 172 | - return $this->locationInfo; |
|
| 173 | - } |
|
| 167 | + /** |
|
| 168 | + * Whether or not file name and line number will be included in the output. |
|
| 169 | + * @return boolean |
|
| 170 | + */ |
|
| 171 | + public function getLocationInfo() { |
|
| 172 | + return $this->locationInfo; |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - /** |
|
| 176 | - * The {@link $locationInfo} option takes a boolean value. By default, |
|
| 177 | - * it is set to false which means there will be no location |
|
| 178 | - * information output by this layout. If the the option is set to |
|
| 179 | - * true, then the file name and line number of the statement at the |
|
| 180 | - * origin of the log statement will be output. |
|
| 181 | - */ |
|
| 182 | - public function setLocationInfo($flag) { |
|
| 183 | - $this->setBoolean('locationInfo', $flag); |
|
| 184 | - } |
|
| 175 | + /** |
|
| 176 | + * The {@link $locationInfo} option takes a boolean value. By default, |
|
| 177 | + * it is set to false which means there will be no location |
|
| 178 | + * information output by this layout. If the the option is set to |
|
| 179 | + * true, then the file name and line number of the statement at the |
|
| 180 | + * origin of the log statement will be output. |
|
| 181 | + */ |
|
| 182 | + public function setLocationInfo($flag) { |
|
| 183 | + $this->setBoolean('locationInfo', $flag); |
|
| 184 | + } |
|
| 185 | 185 | |
| 186 | - /** |
|
| 187 | - * @return boolean |
|
| 188 | - */ |
|
| 189 | - public function getLog4jNamespace() { |
|
| 190 | - return $this->log4jNamespace; |
|
| 191 | - } |
|
| 186 | + /** |
|
| 187 | + * @return boolean |
|
| 188 | + */ |
|
| 189 | + public function getLog4jNamespace() { |
|
| 190 | + return $this->log4jNamespace; |
|
| 191 | + } |
|
| 192 | 192 | |
| 193 | - /** |
|
| 194 | - * @param boolean |
|
| 195 | - */ |
|
| 196 | - public function setLog4jNamespace($flag) { |
|
| 197 | - $this->setBoolean('log4jNamespace', $flag); |
|
| 198 | - } |
|
| 193 | + /** |
|
| 194 | + * @param boolean |
|
| 195 | + */ |
|
| 196 | + public function setLog4jNamespace($flag) { |
|
| 197 | + $this->setBoolean('log4jNamespace', $flag); |
|
| 198 | + } |
|
| 199 | 199 | |
| 200 | - /** |
|
| 201 | - * Encases a string in CDATA tags, and escapes any existing CDATA end |
|
| 202 | - * tags already present in the string. |
|
| 203 | - * @param string $string |
|
| 204 | - */ |
|
| 205 | - private function encodeCDATA($string) { |
|
| 206 | - $string = str_replace(self::CDATA_END, self::CDATA_EMBEDDED_END, $string); |
|
| 207 | - return self::CDATA_START . $string . self::CDATA_END; |
|
| 208 | - } |
|
| 200 | + /** |
|
| 201 | + * Encases a string in CDATA tags, and escapes any existing CDATA end |
|
| 202 | + * tags already present in the string. |
|
| 203 | + * @param string $string |
|
| 204 | + */ |
|
| 205 | + private function encodeCDATA($string) { |
|
| 206 | + $string = str_replace(self::CDATA_END, self::CDATA_EMBEDDED_END, $string); |
|
| 207 | + return self::CDATA_START . $string . self::CDATA_END; |
|
| 208 | + } |
|
| 209 | 209 | } |
| 210 | 210 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @subpackage layouts |
| 55 | 55 | */ |
| 56 | 56 | class Payone_Log4php_LoggerLayoutXml extends Payone_Log4php_LoggerLayout { |
| 57 | - const LOG4J_NS_PREFIX ='log4j'; |
|
| 57 | + const LOG4J_NS_PREFIX = 'log4j'; |
|
| 58 | 58 | const LOG4J_NS = 'http://jakarta.apache.org/log4j/'; |
| 59 | 59 | |
| 60 | 60 | const LOG4PHP_NS_PREFIX = 'log4php'; |
@@ -99,10 +99,10 @@ discard block |
||
| 99 | 99 | * @return string |
| 100 | 100 | */ |
| 101 | 101 | public function getHeader() { |
| 102 | - return "<{$this->namespacePrefix}:eventSet ". |
|
| 103 | - "xmlns:{$this->namespacePrefix}=\"{$this->namespace}\" ". |
|
| 104 | - "version=\"0.3\" ". |
|
| 105 | - "includesLocationInfo=\"".($this->getLocationInfo() ? "true" : "false")."\"". |
|
| 102 | + return "<{$this->namespacePrefix}:eventSet " . |
|
| 103 | + "xmlns:{$this->namespacePrefix}=\"{$this->namespace}\" " . |
|
| 104 | + "version=\"0.3\" " . |
|
| 105 | + "includesLocationInfo=\"" . ($this->getLocationInfo() ? "true" : "false") . "\"" . |
|
| 106 | 106 | ">" . PHP_EOL; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -120,38 +120,38 @@ discard block |
||
| 120 | 120 | $thread = $event->getThreadName(); |
| 121 | 121 | $level = $event->getLevel()->toString(); |
| 122 | 122 | |
| 123 | - $buf = "<$ns:event logger=\"{$loggerName}\" level=\"{$level}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">".PHP_EOL; |
|
| 123 | + $buf = "<$ns:event logger=\"{$loggerName}\" level=\"{$level}\" thread=\"{$thread}\" timestamp=\"{$timeStamp}\">" . PHP_EOL; |
|
| 124 | 124 | $buf .= "<$ns:message>"; |
| 125 | 125 | $buf .= $this->encodeCDATA($event->getRenderedMessage()); |
| 126 | - $buf .= "</$ns:message>".PHP_EOL; |
|
| 126 | + $buf .= "</$ns:message>" . PHP_EOL; |
|
| 127 | 127 | |
| 128 | 128 | $ndc = $event->getNDC(); |
| 129 | - if(!empty($ndc)) { |
|
| 129 | + if (!empty($ndc)) { |
|
| 130 | 130 | $buf .= "<$ns:NDC><![CDATA["; |
| 131 | 131 | $buf .= $this->encodeCDATA($ndc); |
| 132 | - $buf .= "]]></$ns:NDC>".PHP_EOL; |
|
| 132 | + $buf .= "]]></$ns:NDC>" . PHP_EOL; |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | $mdcMap = $event->getMDCMap(); |
| 136 | 136 | if (!empty($mdcMap)) { |
| 137 | - $buf .= "<$ns:properties>".PHP_EOL; |
|
| 137 | + $buf .= "<$ns:properties>" . PHP_EOL; |
|
| 138 | 138 | foreach ($mdcMap as $name=>$value) { |
| 139 | - $buf .= "<$ns:data name=\"$name\" value=\"$value\" />".PHP_EOL; |
|
| 139 | + $buf .= "<$ns:data name=\"$name\" value=\"$value\" />" . PHP_EOL; |
|
| 140 | 140 | } |
| 141 | - $buf .= "</$ns:properties>".PHP_EOL; |
|
| 141 | + $buf .= "</$ns:properties>" . PHP_EOL; |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if ($this->getLocationInfo()) { |
| 145 | 145 | $locationInfo = $event->getLocationInformation(); |
| 146 | - $buf .= "<$ns:locationInfo ". |
|
| 147 | - "class=\"" . $locationInfo->getClassName() . "\" ". |
|
| 148 | - "file=\"" . htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" ". |
|
| 149 | - "line=\"" . $locationInfo->getLineNumber() . "\" ". |
|
| 146 | + $buf .= "<$ns:locationInfo " . |
|
| 147 | + "class=\"" . $locationInfo->getClassName() . "\" " . |
|
| 148 | + "file=\"" . htmlentities($locationInfo->getFileName(), ENT_QUOTES) . "\" " . |
|
| 149 | + "line=\"" . $locationInfo->getLineNumber() . "\" " . |
|
| 150 | 150 | "method=\"" . $locationInfo->getMethodName() . "\" "; |
| 151 | - $buf .= "/>".PHP_EOL; |
|
| 151 | + $buf .= "/>" . PHP_EOL; |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - $buf .= "</$ns:event>".PHP_EOL; |
|
| 154 | + $buf .= "</$ns:event>" . PHP_EOL; |
|
| 155 | 155 | |
| 156 | 156 | return $buf; |
| 157 | 157 | } |
@@ -35,17 +35,17 @@ |
||
| 35 | 35 | */ |
| 36 | 36 | class Payone_Log4php_LoggerAppenderNull extends Payone_Log4php_LoggerAppender { |
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * This appender does not require a layout. |
|
| 40 | - */ |
|
| 41 | - protected $requiresLayout = false; |
|
| 38 | + /** |
|
| 39 | + * This appender does not require a layout. |
|
| 40 | + */ |
|
| 41 | + protected $requiresLayout = false; |
|
| 42 | 42 | |
| 43 | - /** |
|
| 44 | - * Do nothing. |
|
| 45 | - * |
|
| 46 | - * @param Payone_Log4php_LoggerLoggingEvent $event |
|
| 47 | - */ |
|
| 48 | - public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 49 | - } |
|
| 43 | + /** |
|
| 44 | + * Do nothing. |
|
| 45 | + * |
|
| 46 | + * @param Payone_Log4php_LoggerLoggingEvent $event |
|
| 47 | + */ |
|
| 48 | + public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 49 | + } |
|
| 50 | 50 | } |
| 51 | 51 | |
@@ -49,70 +49,70 @@ |
||
| 49 | 49 | */ |
| 50 | 50 | class Payone_Log4php_LoggerMDC { |
| 51 | 51 | |
| 52 | - /** Holds the context map. */ |
|
| 53 | - private static $map = array(); |
|
| 52 | + /** Holds the context map. */ |
|
| 53 | + private static $map = array(); |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Stores a context value as identified with the key parameter into the |
|
| 57 | - * context map. |
|
| 58 | - * |
|
| 59 | - * @param string $key the key |
|
| 60 | - * @param string $value the value |
|
| 61 | - */ |
|
| 62 | - public static function put($key, $value) { |
|
| 63 | - self::$map[$key] = $value; |
|
| 64 | - } |
|
| 55 | + /** |
|
| 56 | + * Stores a context value as identified with the key parameter into the |
|
| 57 | + * context map. |
|
| 58 | + * |
|
| 59 | + * @param string $key the key |
|
| 60 | + * @param string $value the value |
|
| 61 | + */ |
|
| 62 | + public static function put($key, $value) { |
|
| 63 | + self::$map[$key] = $value; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Returns the context value identified by the key parameter. |
|
| 68 | - * |
|
| 69 | - * Special key identifiers can be used to map values in the global $_SERVER |
|
| 70 | - * and $_ENV vars. To access them, use 'server.' or 'env.' followed by the |
|
| 71 | - * desired var name as the key. |
|
| 72 | - * |
|
| 73 | - * @param string $key The key. |
|
| 74 | - * @return string The context or an empty string if no context found |
|
| 75 | - * for given key. |
|
| 76 | - */ |
|
| 77 | - public static function get($key) { |
|
| 78 | - if(!empty($key)) { |
|
| 79 | - if(strpos($key, 'server.') === 0) { |
|
| 80 | - $varName = substr($key, 7); |
|
| 81 | - return isset($_SERVER[$varName]) ? $_SERVER[$varName] : ''; |
|
| 82 | - } else if(strpos($key, 'env.') === 0) { |
|
| 83 | - $varName = substr($key, 4); |
|
| 84 | - $value = getenv($varName); |
|
| 85 | - return ($value !== false) ? $value : ''; |
|
| 86 | - } else { |
|
| 87 | - return isset(self::$map[$key]) ? self::$map[$key] : ''; |
|
| 88 | - } |
|
| 89 | - } |
|
| 90 | - return ''; |
|
| 91 | - } |
|
| 66 | + /** |
|
| 67 | + * Returns the context value identified by the key parameter. |
|
| 68 | + * |
|
| 69 | + * Special key identifiers can be used to map values in the global $_SERVER |
|
| 70 | + * and $_ENV vars. To access them, use 'server.' or 'env.' followed by the |
|
| 71 | + * desired var name as the key. |
|
| 72 | + * |
|
| 73 | + * @param string $key The key. |
|
| 74 | + * @return string The context or an empty string if no context found |
|
| 75 | + * for given key. |
|
| 76 | + */ |
|
| 77 | + public static function get($key) { |
|
| 78 | + if(!empty($key)) { |
|
| 79 | + if(strpos($key, 'server.') === 0) { |
|
| 80 | + $varName = substr($key, 7); |
|
| 81 | + return isset($_SERVER[$varName]) ? $_SERVER[$varName] : ''; |
|
| 82 | + } else if(strpos($key, 'env.') === 0) { |
|
| 83 | + $varName = substr($key, 4); |
|
| 84 | + $value = getenv($varName); |
|
| 85 | + return ($value !== false) ? $value : ''; |
|
| 86 | + } else { |
|
| 87 | + return isset(self::$map[$key]) ? self::$map[$key] : ''; |
|
| 88 | + } |
|
| 89 | + } |
|
| 90 | + return ''; |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - /** |
|
| 94 | - * Returns the contex map as an array. |
|
| 95 | - * @return array The MDC context map. |
|
| 96 | - */ |
|
| 97 | - public static function getMap() { |
|
| 98 | - return self::$map; |
|
| 99 | - } |
|
| 93 | + /** |
|
| 94 | + * Returns the contex map as an array. |
|
| 95 | + * @return array The MDC context map. |
|
| 96 | + */ |
|
| 97 | + public static function getMap() { |
|
| 98 | + return self::$map; |
|
| 99 | + } |
|
| 100 | 100 | |
| 101 | - /** |
|
| 102 | - * Removes the the context identified by the key parameter. |
|
| 103 | - * |
|
| 104 | - * Only affects user mappings, not $_ENV or $_SERVER. |
|
| 105 | - * |
|
| 106 | - * @param string $key The key to be removed. |
|
| 107 | - */ |
|
| 108 | - public static function remove($key) { |
|
| 109 | - unset(self::$map[$key]); |
|
| 110 | - } |
|
| 101 | + /** |
|
| 102 | + * Removes the the context identified by the key parameter. |
|
| 103 | + * |
|
| 104 | + * Only affects user mappings, not $_ENV or $_SERVER. |
|
| 105 | + * |
|
| 106 | + * @param string $key The key to be removed. |
|
| 107 | + */ |
|
| 108 | + public static function remove($key) { |
|
| 109 | + unset(self::$map[$key]); |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - /** |
|
| 113 | - * Clears the mapped diagnostic context. |
|
| 114 | - */ |
|
| 115 | - public static function clear() { |
|
| 116 | - self::$map = array(); |
|
| 117 | - } |
|
| 112 | + /** |
|
| 113 | + * Clears the mapped diagnostic context. |
|
| 114 | + */ |
|
| 115 | + public static function clear() { |
|
| 116 | + self::$map = array(); |
|
| 117 | + } |
|
| 118 | 118 | } |
@@ -75,11 +75,11 @@ |
||
| 75 | 75 | * for given key. |
| 76 | 76 | */ |
| 77 | 77 | public static function get($key) { |
| 78 | - if(!empty($key)) { |
|
| 79 | - if(strpos($key, 'server.') === 0) { |
|
| 78 | + if (!empty($key)) { |
|
| 79 | + if (strpos($key, 'server.') === 0) { |
|
| 80 | 80 | $varName = substr($key, 7); |
| 81 | 81 | return isset($_SERVER[$varName]) ? $_SERVER[$varName] : ''; |
| 82 | - } else if(strpos($key, 'env.') === 0) { |
|
| 82 | + } else if (strpos($key, 'env.') === 0) { |
|
| 83 | 83 | $varName = substr($key, 4); |
| 84 | 84 | $value = getenv($varName); |
| 85 | 85 | return ($value !== false) ? $value : ''; |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class Payone_Log4php_LoggerPatternConverterProcess extends Payone_Log4php_LoggerPatternConverter { |
| 28 | 28 | |
| 29 | - public function convert(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 30 | - return getmypid(); |
|
| 31 | - } |
|
| 29 | + public function convert(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 30 | + return getmypid(); |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -27,128 +27,128 @@ |
||
| 27 | 27 | */ |
| 28 | 28 | class Payone_Log4php_LoggerLayoutPattern extends Payone_Log4php_LoggerLayout { |
| 29 | 29 | |
| 30 | - /** Default conversion pattern */ |
|
| 31 | - const DEFAULT_CONVERSION_PATTERN = '%m%n'; |
|
| 30 | + /** Default conversion pattern */ |
|
| 31 | + const DEFAULT_CONVERSION_PATTERN = '%m%n'; |
|
| 32 | 32 | |
| 33 | - /** Default conversion TTCC Pattern */ |
|
| 34 | - const TTCC_CONVERSION_PATTERN = '%d [%t] %p %c %x - %m%n'; |
|
| 33 | + /** Default conversion TTCC Pattern */ |
|
| 34 | + const TTCC_CONVERSION_PATTERN = '%d [%t] %p %c %x - %m%n'; |
|
| 35 | 35 | |
| 36 | - /** The conversion pattern. */ |
|
| 37 | - protected $pattern = self::DEFAULT_CONVERSION_PATTERN; |
|
| 36 | + /** The conversion pattern. */ |
|
| 37 | + protected $pattern = self::DEFAULT_CONVERSION_PATTERN; |
|
| 38 | 38 | |
| 39 | - /** Maps conversion keywords to the relevant converter. */ |
|
| 40 | - protected static $defaultConverterMap = array( |
|
| 41 | - 'c' => 'LoggerPatternConverterLogger', |
|
| 42 | - 'lo' => 'LoggerPatternConverterLogger', |
|
| 43 | - 'logger' => 'LoggerPatternConverterLogger', |
|
| 39 | + /** Maps conversion keywords to the relevant converter. */ |
|
| 40 | + protected static $defaultConverterMap = array( |
|
| 41 | + 'c' => 'LoggerPatternConverterLogger', |
|
| 42 | + 'lo' => 'LoggerPatternConverterLogger', |
|
| 43 | + 'logger' => 'LoggerPatternConverterLogger', |
|
| 44 | 44 | |
| 45 | - 'C' => 'LoggerPatternConverterClass', |
|
| 46 | - 'class' => 'LoggerPatternConverterClass', |
|
| 45 | + 'C' => 'LoggerPatternConverterClass', |
|
| 46 | + 'class' => 'LoggerPatternConverterClass', |
|
| 47 | 47 | |
| 48 | - 'cookie' => 'LoggerPatternConverterCookie', |
|
| 48 | + 'cookie' => 'LoggerPatternConverterCookie', |
|
| 49 | 49 | |
| 50 | - 'd' => 'LoggerPatternConverterDate', |
|
| 51 | - 'date' => 'LoggerPatternConverterDate', |
|
| 50 | + 'd' => 'LoggerPatternConverterDate', |
|
| 51 | + 'date' => 'LoggerPatternConverterDate', |
|
| 52 | 52 | |
| 53 | - 'e' => 'LoggerPatternConverterEnvironment', |
|
| 54 | - 'env' => 'LoggerPatternConverterEnvironment', |
|
| 53 | + 'e' => 'LoggerPatternConverterEnvironment', |
|
| 54 | + 'env' => 'LoggerPatternConverterEnvironment', |
|
| 55 | 55 | |
| 56 | - 'ex' => 'LoggerPatternConverterThrowable', |
|
| 57 | - 'throwable' => 'LoggerPatternConverterThrowable', |
|
| 56 | + 'ex' => 'LoggerPatternConverterThrowable', |
|
| 57 | + 'throwable' => 'LoggerPatternConverterThrowable', |
|
| 58 | 58 | |
| 59 | - 'F' => 'LoggerPatternConverterFile', |
|
| 60 | - 'file' => 'LoggerPatternConverterFile', |
|
| 59 | + 'F' => 'LoggerPatternConverterFile', |
|
| 60 | + 'file' => 'LoggerPatternConverterFile', |
|
| 61 | 61 | |
| 62 | - 'L' => 'LoggerPatternConverterLine', |
|
| 63 | - 'line' => 'LoggerPatternConverterLine', |
|
| 62 | + 'L' => 'LoggerPatternConverterLine', |
|
| 63 | + 'line' => 'LoggerPatternConverterLine', |
|
| 64 | 64 | |
| 65 | - 'm' => 'LoggerPatternConverterMessage', |
|
| 66 | - 'msg' => 'LoggerPatternConverterMessage', |
|
| 67 | - 'message' => 'LoggerPatternConverterMessage', |
|
| 65 | + 'm' => 'LoggerPatternConverterMessage', |
|
| 66 | + 'msg' => 'LoggerPatternConverterMessage', |
|
| 67 | + 'message' => 'LoggerPatternConverterMessage', |
|
| 68 | 68 | |
| 69 | - 'M' => 'LoggerPatternConverterMethod', |
|
| 70 | - 'method' => 'LoggerPatternConverterMethod', |
|
| 69 | + 'M' => 'LoggerPatternConverterMethod', |
|
| 70 | + 'method' => 'LoggerPatternConverterMethod', |
|
| 71 | 71 | |
| 72 | - 'n' => 'LoggerPatternConverterNewLine', |
|
| 73 | - 'newline' => 'LoggerPatternConverterNewLine', |
|
| 72 | + 'n' => 'LoggerPatternConverterNewLine', |
|
| 73 | + 'newline' => 'LoggerPatternConverterNewLine', |
|
| 74 | 74 | |
| 75 | - 'p' => 'LoggerPatternConverterLevel', |
|
| 76 | - 'le' => 'LoggerPatternConverterLevel', |
|
| 77 | - 'level' => 'LoggerPatternConverterLevel', |
|
| 75 | + 'p' => 'LoggerPatternConverterLevel', |
|
| 76 | + 'le' => 'LoggerPatternConverterLevel', |
|
| 77 | + 'level' => 'LoggerPatternConverterLevel', |
|
| 78 | 78 | |
| 79 | - 'r' => 'LoggerPatternConverterRelative', |
|
| 80 | - 'relative' => 'LoggerPatternConverterRelative', |
|
| 79 | + 'r' => 'LoggerPatternConverterRelative', |
|
| 80 | + 'relative' => 'LoggerPatternConverterRelative', |
|
| 81 | 81 | |
| 82 | - 'req' => 'LoggerPatternConverterRequest', |
|
| 83 | - 'request' => 'LoggerPatternConverterRequest', |
|
| 82 | + 'req' => 'LoggerPatternConverterRequest', |
|
| 83 | + 'request' => 'LoggerPatternConverterRequest', |
|
| 84 | 84 | |
| 85 | - 's' => 'LoggerPatternConverterServer', |
|
| 86 | - 'server' => 'LoggerPatternConverterServer', |
|
| 85 | + 's' => 'LoggerPatternConverterServer', |
|
| 86 | + 'server' => 'LoggerPatternConverterServer', |
|
| 87 | 87 | |
| 88 | - 'ses' => 'LoggerPatternConverterSession', |
|
| 89 | - 'session' => 'LoggerPatternConverterSession', |
|
| 88 | + 'ses' => 'LoggerPatternConverterSession', |
|
| 89 | + 'session' => 'LoggerPatternConverterSession', |
|
| 90 | 90 | |
| 91 | - 'sid' => 'LoggerPatternConverterSessionID', |
|
| 92 | - 'sessionid' => 'LoggerPatternConverterSessionID', |
|
| 91 | + 'sid' => 'LoggerPatternConverterSessionID', |
|
| 92 | + 'sessionid' => 'LoggerPatternConverterSessionID', |
|
| 93 | 93 | |
| 94 | - 't' => 'LoggerPatternConverterProcess', |
|
| 95 | - 'pid' => 'LoggerPatternConverterProcess', |
|
| 96 | - 'process' => 'LoggerPatternConverterProcess', |
|
| 94 | + 't' => 'LoggerPatternConverterProcess', |
|
| 95 | + 'pid' => 'LoggerPatternConverterProcess', |
|
| 96 | + 'process' => 'LoggerPatternConverterProcess', |
|
| 97 | 97 | |
| 98 | - 'x' => 'LoggerPatternConverterNDC', |
|
| 99 | - 'ndc' => 'LoggerPatternConverterNDC', |
|
| 98 | + 'x' => 'LoggerPatternConverterNDC', |
|
| 99 | + 'ndc' => 'LoggerPatternConverterNDC', |
|
| 100 | 100 | |
| 101 | - 'X' => 'LoggerPatternConverterMDC', |
|
| 102 | - 'mdc' => 'LoggerPatternConverterMDC', |
|
| 103 | - ); |
|
| 101 | + 'X' => 'LoggerPatternConverterMDC', |
|
| 102 | + 'mdc' => 'LoggerPatternConverterMDC', |
|
| 103 | + ); |
|
| 104 | 104 | |
| 105 | - protected $converterMap = array(); |
|
| 105 | + protected $converterMap = array(); |
|
| 106 | 106 | |
| 107 | - /** |
|
| 108 | - * Head of a chain of Converters. |
|
| 109 | - * @var Payone_Log4php_LoggerPatternConverter |
|
| 110 | - */ |
|
| 111 | - private $head; |
|
| 107 | + /** |
|
| 108 | + * Head of a chain of Converters. |
|
| 109 | + * @var Payone_Log4php_LoggerPatternConverter |
|
| 110 | + */ |
|
| 111 | + private $head; |
|
| 112 | 112 | |
| 113 | - public static function getDefaultConverterMap() { |
|
| 114 | - return self::$defaultConverterMap; |
|
| 115 | - } |
|
| 113 | + public static function getDefaultConverterMap() { |
|
| 114 | + return self::$defaultConverterMap; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | - public function __construct() { |
|
| 118 | - $this->converterMap = self::$defaultConverterMap; |
|
| 119 | - } |
|
| 117 | + public function __construct() { |
|
| 118 | + $this->converterMap = self::$defaultConverterMap; |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * Set the <b>ConversionPattern</b> option. This is the string which |
|
| 123 | - * controls formatting and consists of a mix of literal content and |
|
| 124 | - * conversion specifiers. |
|
| 125 | - */ |
|
| 126 | - public function setConversionPattern($conversionPattern) { |
|
| 127 | - $this->pattern = $conversionPattern; |
|
| 128 | - } |
|
| 121 | + /** |
|
| 122 | + * Set the <b>ConversionPattern</b> option. This is the string which |
|
| 123 | + * controls formatting and consists of a mix of literal content and |
|
| 124 | + * conversion specifiers. |
|
| 125 | + */ |
|
| 126 | + public function setConversionPattern($conversionPattern) { |
|
| 127 | + $this->pattern = $conversionPattern; |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - public function activateOptions() { |
|
| 131 | - if (!isset($this->pattern)) { |
|
| 132 | - throw new Payone_Log4php_LoggerException("Mandatory parameter 'conversionPattern' is not set."); |
|
| 133 | - } |
|
| 134 | - |
|
| 135 | - $parser = new Payone_Log4php_LoggerPatternParser($this->pattern, $this->converterMap); |
|
| 136 | - $this->head = $parser->parse(); |
|
| 137 | - } |
|
| 130 | + public function activateOptions() { |
|
| 131 | + if (!isset($this->pattern)) { |
|
| 132 | + throw new Payone_Log4php_LoggerException("Mandatory parameter 'conversionPattern' is not set."); |
|
| 133 | + } |
|
| 134 | + |
|
| 135 | + $parser = new Payone_Log4php_LoggerPatternParser($this->pattern, $this->converterMap); |
|
| 136 | + $this->head = $parser->parse(); |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - /** |
|
| 140 | - * Produces a formatted string as specified by the conversion pattern. |
|
| 141 | - * |
|
| 142 | - * @param Payone_Log4php_LoggerLoggingEvent $event |
|
| 143 | - * @return string |
|
| 144 | - */ |
|
| 145 | - public function format(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 146 | - $sbuf = ''; |
|
| 147 | - $converter = $this->head; |
|
| 148 | - while ($converter !== null) { |
|
| 149 | - $converter->format($sbuf, $event); |
|
| 150 | - $converter = $converter->next; |
|
| 151 | - } |
|
| 152 | - return $sbuf; |
|
| 153 | - } |
|
| 139 | + /** |
|
| 140 | + * Produces a formatted string as specified by the conversion pattern. |
|
| 141 | + * |
|
| 142 | + * @param Payone_Log4php_LoggerLoggingEvent $event |
|
| 143 | + * @return string |
|
| 144 | + */ |
|
| 145 | + public function format(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 146 | + $sbuf = ''; |
|
| 147 | + $converter = $this->head; |
|
| 148 | + while ($converter !== null) { |
|
| 149 | + $converter->format($sbuf, $event); |
|
| 150 | + $converter = $converter->next; |
|
| 151 | + } |
|
| 152 | + return $sbuf; |
|
| 153 | + } |
|
| 154 | 154 | } |
| 155 | 155 | \ No newline at end of file |
@@ -26,262 +26,262 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | abstract class Payone_Log4php_LoggerAppender extends Payone_Log4php_LoggerConfigurable { |
| 28 | 28 | |
| 29 | - /** |
|
| 30 | - * Set to true when the appender is closed. A closed appender will not |
|
| 31 | - * accept any logging requests. |
|
| 32 | - * @var boolean |
|
| 33 | - */ |
|
| 34 | - protected $closed = false; |
|
| 29 | + /** |
|
| 30 | + * Set to true when the appender is closed. A closed appender will not |
|
| 31 | + * accept any logging requests. |
|
| 32 | + * @var boolean |
|
| 33 | + */ |
|
| 34 | + protected $closed = false; |
|
| 35 | 35 | |
| 36 | - /** |
|
| 37 | - * The first filter in the filter chain. |
|
| 38 | - * @var LoggerFilter |
|
| 39 | - */ |
|
| 40 | - protected $filter; |
|
| 36 | + /** |
|
| 37 | + * The first filter in the filter chain. |
|
| 38 | + * @var LoggerFilter |
|
| 39 | + */ |
|
| 40 | + protected $filter; |
|
| 41 | 41 | |
| 42 | - /** |
|
| 43 | - * The appender's layout. Can be null if the appender does not use |
|
| 44 | - * a layout. |
|
| 45 | - * @var Payone_Log4php_LoggerLayout |
|
| 46 | - */ |
|
| 47 | - protected $layout; |
|
| 42 | + /** |
|
| 43 | + * The appender's layout. Can be null if the appender does not use |
|
| 44 | + * a layout. |
|
| 45 | + * @var Payone_Log4php_LoggerLayout |
|
| 46 | + */ |
|
| 47 | + protected $layout; |
|
| 48 | 48 | |
| 49 | - /** |
|
| 50 | - * Appender name. Used by other components to identify this appender. |
|
| 51 | - * @var string |
|
| 52 | - */ |
|
| 53 | - protected $name; |
|
| 49 | + /** |
|
| 50 | + * Appender name. Used by other components to identify this appender. |
|
| 51 | + * @var string |
|
| 52 | + */ |
|
| 53 | + protected $name; |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Appender threshold level. Events whose level is below the threshold |
|
| 57 | - * will not be logged. |
|
| 58 | - * @var Payone_Log4php_LoggerLevel |
|
| 59 | - */ |
|
| 60 | - protected $threshold; |
|
| 55 | + /** |
|
| 56 | + * Appender threshold level. Events whose level is below the threshold |
|
| 57 | + * will not be logged. |
|
| 58 | + * @var Payone_Log4php_LoggerLevel |
|
| 59 | + */ |
|
| 60 | + protected $threshold; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Set to true if the appender requires a layout. |
|
| 64 | - * |
|
| 65 | - * True by default, appenders which do not use a layout should override |
|
| 66 | - * this property to false. |
|
| 67 | - * |
|
| 68 | - * @var boolean |
|
| 69 | - */ |
|
| 70 | - protected $requiresLayout = true; |
|
| 62 | + /** |
|
| 63 | + * Set to true if the appender requires a layout. |
|
| 64 | + * |
|
| 65 | + * True by default, appenders which do not use a layout should override |
|
| 66 | + * this property to false. |
|
| 67 | + * |
|
| 68 | + * @var boolean |
|
| 69 | + */ |
|
| 70 | + protected $requiresLayout = true; |
|
| 71 | 71 | |
| 72 | - /** |
|
| 73 | - * Default constructor. |
|
| 74 | - * @param string $name Appender name |
|
| 75 | - */ |
|
| 76 | - public function __construct($name = '') { |
|
| 77 | - $this->name = $name; |
|
| 72 | + /** |
|
| 73 | + * Default constructor. |
|
| 74 | + * @param string $name Appender name |
|
| 75 | + */ |
|
| 76 | + public function __construct($name = '') { |
|
| 77 | + $this->name = $name; |
|
| 78 | 78 | |
| 79 | - // Closes the appender on shutdown. Better than a destructor because |
|
| 80 | - // it will be called even if a fatal error occurs (destructor won't). |
|
| 81 | - register_shutdown_function(array($this, 'close')); |
|
| 79 | + // Closes the appender on shutdown. Better than a destructor because |
|
| 80 | + // it will be called even if a fatal error occurs (destructor won't). |
|
| 81 | + register_shutdown_function(array($this, 'close')); |
|
| 82 | 82 | |
| 83 | - if ($this->requiresLayout) { |
|
| 84 | - $this->layout = $this->getDefaultLayout(); |
|
| 85 | - } |
|
| 86 | - } |
|
| 83 | + if ($this->requiresLayout) { |
|
| 84 | + $this->layout = $this->getDefaultLayout(); |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Returns the default layout for this appender. Can be overriden by |
|
| 90 | - * derived appenders. |
|
| 91 | - * |
|
| 92 | - * @return Payone_Log4php_LoggerLayout |
|
| 93 | - */ |
|
| 94 | - public function getDefaultLayout() |
|
| 95 | - { |
|
| 96 | - return new Payone_Log4php_LoggerLayoutSimple(); |
|
| 97 | - } |
|
| 88 | + /** |
|
| 89 | + * Returns the default layout for this appender. Can be overriden by |
|
| 90 | + * derived appenders. |
|
| 91 | + * |
|
| 92 | + * @return Payone_Log4php_LoggerLayout |
|
| 93 | + */ |
|
| 94 | + public function getDefaultLayout() |
|
| 95 | + { |
|
| 96 | + return new Payone_Log4php_LoggerLayoutSimple(); |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | - /** |
|
| 100 | - * Adds a filter to the end of the filter chain. |
|
| 101 | - * @param LoggerFilter $filter add a new LoggerFilter |
|
| 102 | - */ |
|
| 103 | - public function addFilter($filter) { |
|
| 104 | - if($this->filter === null) { |
|
| 105 | - $this->filter = $filter; |
|
| 106 | - } else { |
|
| 107 | - $this->filter->addNext($filter); |
|
| 108 | - } |
|
| 109 | - } |
|
| 99 | + /** |
|
| 100 | + * Adds a filter to the end of the filter chain. |
|
| 101 | + * @param LoggerFilter $filter add a new LoggerFilter |
|
| 102 | + */ |
|
| 103 | + public function addFilter($filter) { |
|
| 104 | + if($this->filter === null) { |
|
| 105 | + $this->filter = $filter; |
|
| 106 | + } else { |
|
| 107 | + $this->filter->addNext($filter); |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | - /** |
|
| 112 | - * Clears the filter chain by removing all the filters in it. |
|
| 113 | - */ |
|
| 114 | - public function clearFilters() { |
|
| 115 | - $this->filter = null; |
|
| 116 | - } |
|
| 111 | + /** |
|
| 112 | + * Clears the filter chain by removing all the filters in it. |
|
| 113 | + */ |
|
| 114 | + public function clearFilters() { |
|
| 115 | + $this->filter = null; |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Returns the first filter in the filter chain. |
|
| 120 | - * The return value may be <i>null</i> if no is filter is set. |
|
| 121 | - * @return LoggerFilter |
|
| 122 | - */ |
|
| 123 | - public function getFilter() { |
|
| 124 | - return $this->filter; |
|
| 125 | - } |
|
| 118 | + /** |
|
| 119 | + * Returns the first filter in the filter chain. |
|
| 120 | + * The return value may be <i>null</i> if no is filter is set. |
|
| 121 | + * @return LoggerFilter |
|
| 122 | + */ |
|
| 123 | + public function getFilter() { |
|
| 124 | + return $this->filter; |
|
| 125 | + } |
|
| 126 | 126 | |
| 127 | - /** |
|
| 128 | - * Returns the first filter in the filter chain. |
|
| 129 | - * The return value may be <i>null</i> if no is filter is set. |
|
| 130 | - * @return LoggerFilter |
|
| 131 | - */ |
|
| 132 | - public function getFirstFilter() { |
|
| 133 | - return $this->filter; |
|
| 134 | - } |
|
| 127 | + /** |
|
| 128 | + * Returns the first filter in the filter chain. |
|
| 129 | + * The return value may be <i>null</i> if no is filter is set. |
|
| 130 | + * @return LoggerFilter |
|
| 131 | + */ |
|
| 132 | + public function getFirstFilter() { |
|
| 133 | + return $this->filter; |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - /** |
|
| 137 | - * Performs threshold checks and invokes filters before delegating logging |
|
| 138 | - * to the subclass' specific <i>append()</i> method. |
|
| 139 | - * @see Payone_Log4php_LoggerAppender::append() |
|
| 140 | - * @param Payone_Log4php_LoggerLoggingEvent $event |
|
| 141 | - */ |
|
| 142 | - public function doAppend(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 143 | - if($this->closed) { |
|
| 144 | - return; |
|
| 145 | - } |
|
| 136 | + /** |
|
| 137 | + * Performs threshold checks and invokes filters before delegating logging |
|
| 138 | + * to the subclass' specific <i>append()</i> method. |
|
| 139 | + * @see Payone_Log4php_LoggerAppender::append() |
|
| 140 | + * @param Payone_Log4php_LoggerLoggingEvent $event |
|
| 141 | + */ |
|
| 142 | + public function doAppend(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 143 | + if($this->closed) { |
|
| 144 | + return; |
|
| 145 | + } |
|
| 146 | 146 | |
| 147 | - if(!$this->isAsSevereAsThreshold($event->getLevel())) { |
|
| 148 | - return; |
|
| 149 | - } |
|
| 147 | + if(!$this->isAsSevereAsThreshold($event->getLevel())) { |
|
| 148 | + return; |
|
| 149 | + } |
|
| 150 | 150 | |
| 151 | - $f = $this->getFirstFilter(); |
|
| 152 | - while($f !== null) { |
|
| 153 | - switch ($f->decide($event)) { |
|
| 154 | - case Payone_Log4php_LoggerFilter::DENY: return; |
|
| 155 | - case Payone_Log4php_LoggerFilter::ACCEPT: return $this->append($event); |
|
| 156 | - case Payone_Log4php_LoggerFilter::NEUTRAL: $f = $f->getNext(); |
|
| 157 | - } |
|
| 158 | - } |
|
| 159 | - $this->append($event); |
|
| 160 | - } |
|
| 151 | + $f = $this->getFirstFilter(); |
|
| 152 | + while($f !== null) { |
|
| 153 | + switch ($f->decide($event)) { |
|
| 154 | + case Payone_Log4php_LoggerFilter::DENY: return; |
|
| 155 | + case Payone_Log4php_LoggerFilter::ACCEPT: return $this->append($event); |
|
| 156 | + case Payone_Log4php_LoggerFilter::NEUTRAL: $f = $f->getNext(); |
|
| 157 | + } |
|
| 158 | + } |
|
| 159 | + $this->append($event); |
|
| 160 | + } |
|
| 161 | 161 | |
| 162 | - /** |
|
| 163 | - * Sets the appender layout. |
|
| 164 | - * @param Payone_Log4php_LoggerLayout $layout |
|
| 165 | - */ |
|
| 166 | - public function setLayout($layout) { |
|
| 167 | - if($this->requiresLayout()) { |
|
| 168 | - $this->layout = $layout; |
|
| 169 | - } |
|
| 170 | - } |
|
| 162 | + /** |
|
| 163 | + * Sets the appender layout. |
|
| 164 | + * @param Payone_Log4php_LoggerLayout $layout |
|
| 165 | + */ |
|
| 166 | + public function setLayout($layout) { |
|
| 167 | + if($this->requiresLayout()) { |
|
| 168 | + $this->layout = $layout; |
|
| 169 | + } |
|
| 170 | + } |
|
| 171 | 171 | |
| 172 | - /** |
|
| 173 | - * Returns the appender layout. |
|
| 174 | - * @return Payone_Log4php_LoggerLayout |
|
| 175 | - */ |
|
| 176 | - public function getLayout() { |
|
| 177 | - return $this->layout; |
|
| 178 | - } |
|
| 172 | + /** |
|
| 173 | + * Returns the appender layout. |
|
| 174 | + * @return Payone_Log4php_LoggerLayout |
|
| 175 | + */ |
|
| 176 | + public function getLayout() { |
|
| 177 | + return $this->layout; |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - /** |
|
| 181 | - * Configurators call this method to determine if the appender |
|
| 182 | - * requires a layout. |
|
| 183 | - * |
|
| 184 | - * <p>If this method returns <i>true</i>, meaning that layout is required, |
|
| 185 | - * then the configurator will configure a layout using the configuration |
|
| 186 | - * information at its disposal. If this method returns <i>false</i>, |
|
| 187 | - * meaning that a layout is not required, then layout configuration will be |
|
| 188 | - * skipped even if there is available layout configuration |
|
| 189 | - * information at the disposal of the configurator.</p> |
|
| 190 | - * |
|
| 191 | - * <p>In the rather exceptional case, where the appender |
|
| 192 | - * implementation admits a layout but can also work without it, then |
|
| 193 | - * the appender should return <i>true</i>.</p> |
|
| 194 | - * |
|
| 195 | - * @return boolean |
|
| 196 | - */ |
|
| 197 | - public function requiresLayout() { |
|
| 198 | - return $this->requiresLayout; |
|
| 199 | - } |
|
| 180 | + /** |
|
| 181 | + * Configurators call this method to determine if the appender |
|
| 182 | + * requires a layout. |
|
| 183 | + * |
|
| 184 | + * <p>If this method returns <i>true</i>, meaning that layout is required, |
|
| 185 | + * then the configurator will configure a layout using the configuration |
|
| 186 | + * information at its disposal. If this method returns <i>false</i>, |
|
| 187 | + * meaning that a layout is not required, then layout configuration will be |
|
| 188 | + * skipped even if there is available layout configuration |
|
| 189 | + * information at the disposal of the configurator.</p> |
|
| 190 | + * |
|
| 191 | + * <p>In the rather exceptional case, where the appender |
|
| 192 | + * implementation admits a layout but can also work without it, then |
|
| 193 | + * the appender should return <i>true</i>.</p> |
|
| 194 | + * |
|
| 195 | + * @return boolean |
|
| 196 | + */ |
|
| 197 | + public function requiresLayout() { |
|
| 198 | + return $this->requiresLayout; |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | - /** |
|
| 202 | - * Retruns the appender name. |
|
| 203 | - * @return string |
|
| 204 | - */ |
|
| 205 | - public function getName() { |
|
| 206 | - return $this->name; |
|
| 207 | - } |
|
| 201 | + /** |
|
| 202 | + * Retruns the appender name. |
|
| 203 | + * @return string |
|
| 204 | + */ |
|
| 205 | + public function getName() { |
|
| 206 | + return $this->name; |
|
| 207 | + } |
|
| 208 | 208 | |
| 209 | - /** |
|
| 210 | - * Sets the appender name. |
|
| 211 | - * @param string $name |
|
| 212 | - */ |
|
| 213 | - public function setName($name) { |
|
| 214 | - $this->name = $name; |
|
| 215 | - } |
|
| 209 | + /** |
|
| 210 | + * Sets the appender name. |
|
| 211 | + * @param string $name |
|
| 212 | + */ |
|
| 213 | + public function setName($name) { |
|
| 214 | + $this->name = $name; |
|
| 215 | + } |
|
| 216 | 216 | |
| 217 | - /** |
|
| 218 | - * Returns the appender's threshold level. |
|
| 219 | - * @return Payone_Log4php_LoggerLevel |
|
| 220 | - */ |
|
| 221 | - public function getThreshold() { |
|
| 222 | - return $this->threshold; |
|
| 223 | - } |
|
| 217 | + /** |
|
| 218 | + * Returns the appender's threshold level. |
|
| 219 | + * @return Payone_Log4php_LoggerLevel |
|
| 220 | + */ |
|
| 221 | + public function getThreshold() { |
|
| 222 | + return $this->threshold; |
|
| 223 | + } |
|
| 224 | 224 | |
| 225 | - /** |
|
| 226 | - * Sets the appender threshold. |
|
| 227 | - * |
|
| 228 | - * @param Payone_Log4php_LoggerLevel|string $threshold Either a {@link LoggerLevel} |
|
| 229 | - * object or a string equivalent. |
|
| 230 | - * @see LoggerOptionConverter::toLevel() |
|
| 231 | - */ |
|
| 232 | - public function setThreshold($threshold) { |
|
| 233 | - $this->setLevel('threshold', $threshold); |
|
| 234 | - } |
|
| 225 | + /** |
|
| 226 | + * Sets the appender threshold. |
|
| 227 | + * |
|
| 228 | + * @param Payone_Log4php_LoggerLevel|string $threshold Either a {@link LoggerLevel} |
|
| 229 | + * object or a string equivalent. |
|
| 230 | + * @see LoggerOptionConverter::toLevel() |
|
| 231 | + */ |
|
| 232 | + public function setThreshold($threshold) { |
|
| 233 | + $this->setLevel('threshold', $threshold); |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | - /** |
|
| 237 | - * Checks whether the message level is below the appender's threshold. |
|
| 238 | - * |
|
| 239 | - * If there is no threshold set, then the return value is always <i>true</i>. |
|
| 240 | - * |
|
| 241 | - * @param Payone_Log4php_LoggerLevel $level |
|
| 242 | - * @return boolean Returns true if level is greater or equal than |
|
| 243 | - * threshold, or if the threshold is not set. Otherwise returns false. |
|
| 244 | - */ |
|
| 245 | - public function isAsSevereAsThreshold($level) { |
|
| 246 | - if($this->threshold === null) { |
|
| 247 | - return true; |
|
| 248 | - } |
|
| 249 | - return $level->isGreaterOrEqual($this->getThreshold()); |
|
| 250 | - } |
|
| 236 | + /** |
|
| 237 | + * Checks whether the message level is below the appender's threshold. |
|
| 238 | + * |
|
| 239 | + * If there is no threshold set, then the return value is always <i>true</i>. |
|
| 240 | + * |
|
| 241 | + * @param Payone_Log4php_LoggerLevel $level |
|
| 242 | + * @return boolean Returns true if level is greater or equal than |
|
| 243 | + * threshold, or if the threshold is not set. Otherwise returns false. |
|
| 244 | + */ |
|
| 245 | + public function isAsSevereAsThreshold($level) { |
|
| 246 | + if($this->threshold === null) { |
|
| 247 | + return true; |
|
| 248 | + } |
|
| 249 | + return $level->isGreaterOrEqual($this->getThreshold()); |
|
| 250 | + } |
|
| 251 | 251 | |
| 252 | - /** |
|
| 253 | - * Prepares the appender for logging. |
|
| 254 | - * |
|
| 255 | - * Derived appenders should override this method if option structure |
|
| 256 | - * requires it. |
|
| 257 | - */ |
|
| 258 | - public function activateOptions() { |
|
| 259 | - $this->closed = false; |
|
| 260 | - } |
|
| 252 | + /** |
|
| 253 | + * Prepares the appender for logging. |
|
| 254 | + * |
|
| 255 | + * Derived appenders should override this method if option structure |
|
| 256 | + * requires it. |
|
| 257 | + */ |
|
| 258 | + public function activateOptions() { |
|
| 259 | + $this->closed = false; |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | - /** |
|
| 263 | - * Forwards the logging event to the destination. |
|
| 264 | - * |
|
| 265 | - * Derived appenders should implement this method to perform actual logging. |
|
| 266 | - * |
|
| 267 | - * @param Payone_Log4php_LoggerLoggingEvent $event |
|
| 268 | - */ |
|
| 269 | - abstract protected function append(Payone_Log4php_LoggerLoggingEvent $event); |
|
| 262 | + /** |
|
| 263 | + * Forwards the logging event to the destination. |
|
| 264 | + * |
|
| 265 | + * Derived appenders should implement this method to perform actual logging. |
|
| 266 | + * |
|
| 267 | + * @param Payone_Log4php_LoggerLoggingEvent $event |
|
| 268 | + */ |
|
| 269 | + abstract protected function append(Payone_Log4php_LoggerLoggingEvent $event); |
|
| 270 | 270 | |
| 271 | - /** |
|
| 272 | - * Releases any resources allocated by the appender. |
|
| 273 | - * |
|
| 274 | - * Derived appenders should override this method to perform proper closing |
|
| 275 | - * procedures. |
|
| 276 | - */ |
|
| 277 | - public function close() { |
|
| 278 | - $this->closed = true; |
|
| 279 | - } |
|
| 271 | + /** |
|
| 272 | + * Releases any resources allocated by the appender. |
|
| 273 | + * |
|
| 274 | + * Derived appenders should override this method to perform proper closing |
|
| 275 | + * procedures. |
|
| 276 | + */ |
|
| 277 | + public function close() { |
|
| 278 | + $this->closed = true; |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - /** Triggers a warning for this logger with the given message. */ |
|
| 282 | - protected function warn($message) { |
|
| 283 | - $id = get_class($this) . (empty($this->name) ? '' : ":{$this->name}"); |
|
| 284 | - trigger_error("log4php: [$id]: $message", E_USER_WARNING); |
|
| 285 | - } |
|
| 281 | + /** Triggers a warning for this logger with the given message. */ |
|
| 282 | + protected function warn($message) { |
|
| 283 | + $id = get_class($this) . (empty($this->name) ? '' : ":{$this->name}"); |
|
| 284 | + trigger_error("log4php: [$id]: $message", E_USER_WARNING); |
|
| 285 | + } |
|
| 286 | 286 | |
| 287 | 287 | } |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | * @param LoggerFilter $filter add a new LoggerFilter |
| 102 | 102 | */ |
| 103 | 103 | public function addFilter($filter) { |
| 104 | - if($this->filter === null) { |
|
| 104 | + if ($this->filter === null) { |
|
| 105 | 105 | $this->filter = $filter; |
| 106 | 106 | } else { |
| 107 | 107 | $this->filter->addNext($filter); |
@@ -140,16 +140,16 @@ discard block |
||
| 140 | 140 | * @param Payone_Log4php_LoggerLoggingEvent $event |
| 141 | 141 | */ |
| 142 | 142 | public function doAppend(Payone_Log4php_LoggerLoggingEvent $event) { |
| 143 | - if($this->closed) { |
|
| 143 | + if ($this->closed) { |
|
| 144 | 144 | return; |
| 145 | 145 | } |
| 146 | 146 | |
| 147 | - if(!$this->isAsSevereAsThreshold($event->getLevel())) { |
|
| 147 | + if (!$this->isAsSevereAsThreshold($event->getLevel())) { |
|
| 148 | 148 | return; |
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $f = $this->getFirstFilter(); |
| 152 | - while($f !== null) { |
|
| 152 | + while ($f !== null) { |
|
| 153 | 153 | switch ($f->decide($event)) { |
| 154 | 154 | case Payone_Log4php_LoggerFilter::DENY: return; |
| 155 | 155 | case Payone_Log4php_LoggerFilter::ACCEPT: return $this->append($event); |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | * @param Payone_Log4php_LoggerLayout $layout |
| 165 | 165 | */ |
| 166 | 166 | public function setLayout($layout) { |
| 167 | - if($this->requiresLayout()) { |
|
| 167 | + if ($this->requiresLayout()) { |
|
| 168 | 168 | $this->layout = $layout; |
| 169 | 169 | } |
| 170 | 170 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | * threshold, or if the threshold is not set. Otherwise returns false. |
| 244 | 244 | */ |
| 245 | 245 | public function isAsSevereAsThreshold($level) { |
| 246 | - if($this->threshold === null) { |
|
| 246 | + if ($this->threshold === null) { |
|
| 247 | 247 | return true; |
| 248 | 248 | } |
| 249 | 249 | return $level->isGreaterOrEqual($this->getThreshold()); |
@@ -42,121 +42,121 @@ |
||
| 42 | 42 | */ |
| 43 | 43 | class Payone_Log4php_LoggerAppenderFile extends Payone_Log4php_LoggerAppender { |
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * @var boolean if {@link $file} exists, appends events. |
|
| 47 | - */ |
|
| 48 | - protected $append = true; |
|
| 45 | + /** |
|
| 46 | + * @var boolean if {@link $file} exists, appends events. |
|
| 47 | + */ |
|
| 48 | + protected $append = true; |
|
| 49 | 49 | |
| 50 | - /** |
|
| 51 | - * @var string the file name used to append events |
|
| 52 | - */ |
|
| 53 | - protected $file; |
|
| 50 | + /** |
|
| 51 | + * @var string the file name used to append events |
|
| 52 | + */ |
|
| 53 | + protected $file; |
|
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * @var mixed file resource |
|
| 57 | - */ |
|
| 58 | - protected $fp = false; |
|
| 55 | + /** |
|
| 56 | + * @var mixed file resource |
|
| 57 | + */ |
|
| 58 | + protected $fp = false; |
|
| 59 | 59 | |
| 60 | - public function activateOptions() { |
|
| 61 | - $fileName = $this->getFile(); |
|
| 60 | + public function activateOptions() { |
|
| 61 | + $fileName = $this->getFile(); |
|
| 62 | 62 | |
| 63 | - if (empty($fileName)) { |
|
| 64 | - $this->warn("Required parameter 'fileName' not set. Closing appender."); |
|
| 65 | - $this->closed = true; |
|
| 66 | - return; |
|
| 67 | - } |
|
| 63 | + if (empty($fileName)) { |
|
| 64 | + $this->warn("Required parameter 'fileName' not set. Closing appender."); |
|
| 65 | + $this->closed = true; |
|
| 66 | + return; |
|
| 67 | + } |
|
| 68 | 68 | |
| 69 | - if(!is_file($fileName)) { |
|
| 70 | - $dir = dirname($fileName); |
|
| 71 | - if(!is_dir($dir)) { |
|
| 72 | - mkdir($dir, 0777, true); |
|
| 73 | - } |
|
| 74 | - } |
|
| 69 | + if(!is_file($fileName)) { |
|
| 70 | + $dir = dirname($fileName); |
|
| 71 | + if(!is_dir($dir)) { |
|
| 72 | + mkdir($dir, 0777, true); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - $this->fp = fopen($fileName, ($this->getAppend()? 'a':'w')); |
|
| 77 | - if($this->fp) { |
|
| 78 | - if(flock($this->fp, LOCK_EX)) { |
|
| 79 | - if($this->getAppend()) { |
|
| 80 | - fseek($this->fp, 0, SEEK_END); |
|
| 81 | - } |
|
| 82 | - fwrite($this->fp, $this->layout->getHeader()); |
|
| 83 | - flock($this->fp, LOCK_UN); |
|
| 84 | - $this->closed = false; |
|
| 85 | - } else { |
|
| 86 | - // TODO: should we take some action in this case? |
|
| 87 | - $this->closed = true; |
|
| 88 | - } |
|
| 89 | - } else { |
|
| 90 | - $this->closed = true; |
|
| 91 | - } |
|
| 92 | - } |
|
| 76 | + $this->fp = fopen($fileName, ($this->getAppend()? 'a':'w')); |
|
| 77 | + if($this->fp) { |
|
| 78 | + if(flock($this->fp, LOCK_EX)) { |
|
| 79 | + if($this->getAppend()) { |
|
| 80 | + fseek($this->fp, 0, SEEK_END); |
|
| 81 | + } |
|
| 82 | + fwrite($this->fp, $this->layout->getHeader()); |
|
| 83 | + flock($this->fp, LOCK_UN); |
|
| 84 | + $this->closed = false; |
|
| 85 | + } else { |
|
| 86 | + // TODO: should we take some action in this case? |
|
| 87 | + $this->closed = true; |
|
| 88 | + } |
|
| 89 | + } else { |
|
| 90 | + $this->closed = true; |
|
| 91 | + } |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - public function close() { |
|
| 95 | - if($this->closed != true) { |
|
| 96 | - if($this->fp and $this->layout !== null) { |
|
| 97 | - if(flock($this->fp, LOCK_EX)) { |
|
| 98 | - fwrite($this->fp, $this->layout->getFooter()); |
|
| 99 | - flock($this->fp, LOCK_UN); |
|
| 100 | - } |
|
| 101 | - fclose($this->fp); |
|
| 102 | - } |
|
| 103 | - $this->closed = true; |
|
| 104 | - } |
|
| 105 | - } |
|
| 94 | + public function close() { |
|
| 95 | + if($this->closed != true) { |
|
| 96 | + if($this->fp and $this->layout !== null) { |
|
| 97 | + if(flock($this->fp, LOCK_EX)) { |
|
| 98 | + fwrite($this->fp, $this->layout->getFooter()); |
|
| 99 | + flock($this->fp, LOCK_UN); |
|
| 100 | + } |
|
| 101 | + fclose($this->fp); |
|
| 102 | + } |
|
| 103 | + $this->closed = true; |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | 106 | |
| 107 | - public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 108 | - if($this->fp and $this->layout !== null) { |
|
| 109 | - if(flock($this->fp, LOCK_EX)) { |
|
| 110 | - fwrite($this->fp, $this->layout->format($event)); |
|
| 111 | - flock($this->fp, LOCK_UN); |
|
| 112 | - } else { |
|
| 113 | - $this->closed = true; |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - } |
|
| 107 | + public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 108 | + if($this->fp and $this->layout !== null) { |
|
| 109 | + if(flock($this->fp, LOCK_EX)) { |
|
| 110 | + fwrite($this->fp, $this->layout->format($event)); |
|
| 111 | + flock($this->fp, LOCK_UN); |
|
| 112 | + } else { |
|
| 113 | + $this->closed = true; |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + } |
|
| 117 | 117 | |
| 118 | - /** |
|
| 119 | - * Sets the file where the log output will go. |
|
| 120 | - * @param string $file |
|
| 121 | - */ |
|
| 122 | - public function setFile($file) { |
|
| 123 | - $this->setString('file', $file); |
|
| 124 | - } |
|
| 118 | + /** |
|
| 119 | + * Sets the file where the log output will go. |
|
| 120 | + * @param string $file |
|
| 121 | + */ |
|
| 122 | + public function setFile($file) { |
|
| 123 | + $this->setString('file', $file); |
|
| 124 | + } |
|
| 125 | 125 | |
| 126 | - /** |
|
| 127 | - * @return string |
|
| 128 | - */ |
|
| 129 | - public function getFile() { |
|
| 130 | - return $this->file; |
|
| 131 | - } |
|
| 126 | + /** |
|
| 127 | + * @return string |
|
| 128 | + */ |
|
| 129 | + public function getFile() { |
|
| 130 | + return $this->file; |
|
| 131 | + } |
|
| 132 | 132 | |
| 133 | - /** |
|
| 134 | - * @return boolean |
|
| 135 | - */ |
|
| 136 | - public function getAppend() { |
|
| 137 | - return $this->append; |
|
| 138 | - } |
|
| 133 | + /** |
|
| 134 | + * @return boolean |
|
| 135 | + */ |
|
| 136 | + public function getAppend() { |
|
| 137 | + return $this->append; |
|
| 138 | + } |
|
| 139 | 139 | |
| 140 | - public function setAppend($append) { |
|
| 141 | - $this->setBoolean('append', $append); |
|
| 142 | - } |
|
| 140 | + public function setAppend($append) { |
|
| 141 | + $this->setBoolean('append', $append); |
|
| 142 | + } |
|
| 143 | 143 | |
| 144 | - /** |
|
| 145 | - * Sets the file where the log output will go. |
|
| 146 | - * @param string $fileName |
|
| 147 | - * @deprecated Use setFile() instead. |
|
| 148 | - */ |
|
| 149 | - public function setFileName($fileName) { |
|
| 150 | - $this->setFile($fileName); |
|
| 151 | - } |
|
| 144 | + /** |
|
| 145 | + * Sets the file where the log output will go. |
|
| 146 | + * @param string $fileName |
|
| 147 | + * @deprecated Use setFile() instead. |
|
| 148 | + */ |
|
| 149 | + public function setFileName($fileName) { |
|
| 150 | + $this->setFile($fileName); |
|
| 151 | + } |
|
| 152 | 152 | |
| 153 | - /** |
|
| 154 | - * @return string |
|
| 155 | - * @deprecated Use getFile() instead. |
|
| 156 | - */ |
|
| 157 | - public function getFileName() { |
|
| 158 | - return $this->getFile(); |
|
| 159 | - } |
|
| 153 | + /** |
|
| 154 | + * @return string |
|
| 155 | + * @deprecated Use getFile() instead. |
|
| 156 | + */ |
|
| 157 | + public function getFileName() { |
|
| 158 | + return $this->getFile(); |
|
| 159 | + } |
|
| 160 | 160 | |
| 161 | 161 | |
| 162 | 162 | } |
@@ -66,17 +66,17 @@ discard block |
||
| 66 | 66 | return; |
| 67 | 67 | } |
| 68 | 68 | |
| 69 | - if(!is_file($fileName)) { |
|
| 69 | + if (!is_file($fileName)) { |
|
| 70 | 70 | $dir = dirname($fileName); |
| 71 | - if(!is_dir($dir)) { |
|
| 71 | + if (!is_dir($dir)) { |
|
| 72 | 72 | mkdir($dir, 0777, true); |
| 73 | 73 | } |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $this->fp = fopen($fileName, ($this->getAppend()? 'a':'w')); |
|
| 77 | - if($this->fp) { |
|
| 78 | - if(flock($this->fp, LOCK_EX)) { |
|
| 79 | - if($this->getAppend()) { |
|
| 76 | + $this->fp = fopen($fileName, ($this->getAppend() ? 'a' : 'w')); |
|
| 77 | + if ($this->fp) { |
|
| 78 | + if (flock($this->fp, LOCK_EX)) { |
|
| 79 | + if ($this->getAppend()) { |
|
| 80 | 80 | fseek($this->fp, 0, SEEK_END); |
| 81 | 81 | } |
| 82 | 82 | fwrite($this->fp, $this->layout->getHeader()); |
@@ -92,9 +92,9 @@ discard block |
||
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | public function close() { |
| 95 | - if($this->closed != true) { |
|
| 96 | - if($this->fp and $this->layout !== null) { |
|
| 97 | - if(flock($this->fp, LOCK_EX)) { |
|
| 95 | + if ($this->closed != true) { |
|
| 96 | + if ($this->fp and $this->layout !== null) { |
|
| 97 | + if (flock($this->fp, LOCK_EX)) { |
|
| 98 | 98 | fwrite($this->fp, $this->layout->getFooter()); |
| 99 | 99 | flock($this->fp, LOCK_UN); |
| 100 | 100 | } |
@@ -105,8 +105,8 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
| 108 | - if($this->fp and $this->layout !== null) { |
|
| 109 | - if(flock($this->fp, LOCK_EX)) { |
|
| 108 | + if ($this->fp and $this->layout !== null) { |
|
| 109 | + if (flock($this->fp, LOCK_EX)) { |
|
| 110 | 110 | fwrite($this->fp, $this->layout->format($event)); |
| 111 | 111 | flock($this->fp, LOCK_UN); |
| 112 | 112 | } else { |