@@ -47,67 +47,66 @@ |
||
| 47 | 47 | * Tue Sep 8 21:51:04 2009,120 [5485] FATAL root - Some critical message! |
| 48 | 48 | * Tue Sep 8 21:51:06 2009,120 [5485] FATAL root - Some more critical message! |
| 49 | 49 | * </pre> |
| 50 | - |
|
| 51 | 50 | * @version $Revision$ |
| 52 | 51 | * @package log4php |
| 53 | 52 | * @subpackage appenders |
| 54 | 53 | */ |
| 55 | 54 | class Payone_Log4php_LoggerAppenderMail extends Payone_Log4php_LoggerAppender { |
| 56 | 55 | |
| 57 | - /** @var string 'from' field */ |
|
| 58 | - protected $from = null; |
|
| 56 | + /** @var string 'from' field */ |
|
| 57 | + protected $from = null; |
|
| 59 | 58 | |
| 60 | - /** @var string 'subject' field */ |
|
| 61 | - protected $subject = 'Log4php Report'; |
|
| 59 | + /** @var string 'subject' field */ |
|
| 60 | + protected $subject = 'Log4php Report'; |
|
| 62 | 61 | |
| 63 | - /** @var string 'to' field */ |
|
| 64 | - protected $to = null; |
|
| 62 | + /** @var string 'to' field */ |
|
| 63 | + protected $to = null; |
|
| 65 | 64 | |
| 66 | - /** @var indiciates if this appender should run in dry mode */ |
|
| 67 | - protected $dry = false; |
|
| 65 | + /** @var indiciates if this appender should run in dry mode */ |
|
| 66 | + protected $dry = false; |
|
| 68 | 67 | |
| 69 | - /** @var string used to create mail body */ |
|
| 70 | - protected $body = ''; |
|
| 68 | + /** @var string used to create mail body */ |
|
| 69 | + protected $body = ''; |
|
| 71 | 70 | |
| 72 | - public function close() { |
|
| 73 | - if($this->closed != true) { |
|
| 74 | - $from = $this->from; |
|
| 75 | - $to = $this->to; |
|
| 71 | + public function close() { |
|
| 72 | + if($this->closed != true) { |
|
| 73 | + $from = $this->from; |
|
| 74 | + $to = $this->to; |
|
| 76 | 75 | |
| 77 | - if(!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) { |
|
| 78 | - $subject = $this->subject; |
|
| 79 | - if(!$this->dry) { |
|
| 80 | - mail( |
|
| 81 | - $to, $subject, |
|
| 82 | - $this->layout->getHeader() . $this->body . $this->layout->getFooter(), |
|
| 83 | - "From: {$from}\r\n"); |
|
| 84 | - } else { |
|
| 85 | - echo "DRY MODE OF MAIL APP.: Send mail to: ".$to." with content: ".$this->body; |
|
| 86 | - } |
|
| 87 | - } |
|
| 88 | - $this->closed = true; |
|
| 89 | - } |
|
| 90 | - } |
|
| 76 | + if(!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) { |
|
| 77 | + $subject = $this->subject; |
|
| 78 | + if(!$this->dry) { |
|
| 79 | + mail( |
|
| 80 | + $to, $subject, |
|
| 81 | + $this->layout->getHeader() . $this->body . $this->layout->getFooter(), |
|
| 82 | + "From: {$from}\r\n"); |
|
| 83 | + } else { |
|
| 84 | + echo "DRY MODE OF MAIL APP.: Send mail to: ".$to." with content: ".$this->body; |
|
| 85 | + } |
|
| 86 | + } |
|
| 87 | + $this->closed = true; |
|
| 88 | + } |
|
| 89 | + } |
|
| 91 | 90 | |
| 92 | - public function setSubject($subject) { |
|
| 93 | - $this->setString('subject', $subject); |
|
| 94 | - } |
|
| 91 | + public function setSubject($subject) { |
|
| 92 | + $this->setString('subject', $subject); |
|
| 93 | + } |
|
| 95 | 94 | |
| 96 | - public function setTo($to) { |
|
| 97 | - $this->setString('to', $to); |
|
| 98 | - } |
|
| 95 | + public function setTo($to) { |
|
| 96 | + $this->setString('to', $to); |
|
| 97 | + } |
|
| 99 | 98 | |
| 100 | - public function setFrom($from) { |
|
| 101 | - $this->setString('from', $from); |
|
| 102 | - } |
|
| 99 | + public function setFrom($from) { |
|
| 100 | + $this->setString('from', $from); |
|
| 101 | + } |
|
| 103 | 102 | |
| 104 | - public function setDry($dry) { |
|
| 105 | - $this->setBoolean('dry', $dry); |
|
| 106 | - } |
|
| 103 | + public function setDry($dry) { |
|
| 104 | + $this->setBoolean('dry', $dry); |
|
| 105 | + } |
|
| 107 | 106 | |
| 108 | - public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 109 | - if($this->layout !== null) { |
|
| 110 | - $this->body .= $this->layout->format($event); |
|
| 111 | - } |
|
| 112 | - } |
|
| 107 | + public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 108 | + if($this->layout !== null) { |
|
| 109 | + $this->body .= $this->layout->format($event); |
|
| 110 | + } |
|
| 111 | + } |
|
| 113 | 112 | } |
@@ -70,19 +70,19 @@ discard block |
||
| 70 | 70 | protected $body = ''; |
| 71 | 71 | |
| 72 | 72 | public function close() { |
| 73 | - if($this->closed != true) { |
|
| 73 | + if ($this->closed != true) { |
|
| 74 | 74 | $from = $this->from; |
| 75 | 75 | $to = $this->to; |
| 76 | 76 | |
| 77 | - if(!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) { |
|
| 77 | + if (!empty($this->body) and $from !== null and $to !== null and $this->layout !== null) { |
|
| 78 | 78 | $subject = $this->subject; |
| 79 | - if(!$this->dry) { |
|
| 79 | + if (!$this->dry) { |
|
| 80 | 80 | mail( |
| 81 | 81 | $to, $subject, |
| 82 | 82 | $this->layout->getHeader() . $this->body . $this->layout->getFooter(), |
| 83 | 83 | "From: {$from}\r\n"); |
| 84 | 84 | } else { |
| 85 | - echo "DRY MODE OF MAIL APP.: Send mail to: ".$to." with content: ".$this->body; |
|
| 85 | + echo "DRY MODE OF MAIL APP.: Send mail to: " . $to . " with content: " . $this->body; |
|
| 86 | 86 | } |
| 87 | 87 | } |
| 88 | 88 | $this->closed = true; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
| 109 | - if($this->layout !== null) { |
|
| 109 | + if ($this->layout !== null) { |
|
| 110 | 110 | $this->body .= $this->layout->format($event); |
| 111 | 111 | } |
| 112 | 112 | } |
@@ -36,87 +36,87 @@ |
||
| 36 | 36 | */ |
| 37 | 37 | class Payone_Log4php_LoggerAppenderSocket extends Payone_Log4php_LoggerAppender { |
| 38 | 38 | |
| 39 | - /** |
|
| 40 | - * Target host. |
|
| 41 | - * @see http://php.net/manual/en/function.fsockopen.php |
|
| 42 | - */ |
|
| 43 | - protected $remoteHost; |
|
| 44 | - |
|
| 45 | - /** Target port */ |
|
| 46 | - protected $port = 4446; |
|
| 47 | - |
|
| 48 | - /** Connection timeout in ms. */ |
|
| 49 | - protected $timeout; |
|
| 50 | - |
|
| 51 | - // ****************************************** |
|
| 52 | - // *** Appender methods *** |
|
| 53 | - // ****************************************** |
|
| 54 | - |
|
| 55 | - /** Override the default layout to use serialized. */ |
|
| 56 | - public function getDefaultLayout() { |
|
| 57 | - return new Payone_Log4php_LoggerLayoutSerialized(); |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - public function activateOptions() { |
|
| 61 | - if (empty($this->remoteHost)) { |
|
| 62 | - $this->warn("Required parameter [remoteHost] not set. Closing appender."); |
|
| 63 | - $this->closed = true; |
|
| 64 | - return; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - if (empty($this->timeout)) { |
|
| 68 | - $this->timeout = ini_get("default_socket_timeout"); |
|
| 69 | - } |
|
| 70 | - |
|
| 71 | - $this->closed = false; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 75 | - $socket = fsockopen($this->remoteHost, $this->port, $errno, $errstr, $this->timeout); |
|
| 76 | - if ($socket === false) { |
|
| 77 | - $this->warn("Could not open socket to {$this->remoteHost}:{$this->port}. Closing appender."); |
|
| 78 | - $this->closed = true; |
|
| 79 | - return; |
|
| 80 | - } |
|
| 81 | - |
|
| 82 | - if (false === fwrite($socket, $this->layout->format($event))) { |
|
| 83 | - $this->warn("Error writing to socket. Closing appender."); |
|
| 84 | - $this->closed = true; |
|
| 85 | - } |
|
| 86 | - fclose($socket); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - // ****************************************** |
|
| 90 | - // *** Accessor methods *** |
|
| 91 | - // ****************************************** |
|
| 92 | - |
|
| 93 | - /** Sets the target host. */ |
|
| 94 | - public function setRemoteHost($hostname) { |
|
| 95 | - $this->setString('remoteHost', $hostname); |
|
| 96 | - } |
|
| 97 | - |
|
| 98 | - /** Sets the target port */ |
|
| 99 | - public function setPort($port) { |
|
| 100 | - $this->setPositiveInteger('port', $port); |
|
| 101 | - } |
|
| 39 | + /** |
|
| 40 | + * Target host. |
|
| 41 | + * @see http://php.net/manual/en/function.fsockopen.php |
|
| 42 | + */ |
|
| 43 | + protected $remoteHost; |
|
| 44 | + |
|
| 45 | + /** Target port */ |
|
| 46 | + protected $port = 4446; |
|
| 47 | + |
|
| 48 | + /** Connection timeout in ms. */ |
|
| 49 | + protected $timeout; |
|
| 50 | + |
|
| 51 | + // ****************************************** |
|
| 52 | + // *** Appender methods *** |
|
| 53 | + // ****************************************** |
|
| 54 | + |
|
| 55 | + /** Override the default layout to use serialized. */ |
|
| 56 | + public function getDefaultLayout() { |
|
| 57 | + return new Payone_Log4php_LoggerLayoutSerialized(); |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + public function activateOptions() { |
|
| 61 | + if (empty($this->remoteHost)) { |
|
| 62 | + $this->warn("Required parameter [remoteHost] not set. Closing appender."); |
|
| 63 | + $this->closed = true; |
|
| 64 | + return; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + if (empty($this->timeout)) { |
|
| 68 | + $this->timeout = ini_get("default_socket_timeout"); |
|
| 69 | + } |
|
| 70 | + |
|
| 71 | + $this->closed = false; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 75 | + $socket = fsockopen($this->remoteHost, $this->port, $errno, $errstr, $this->timeout); |
|
| 76 | + if ($socket === false) { |
|
| 77 | + $this->warn("Could not open socket to {$this->remoteHost}:{$this->port}. Closing appender."); |
|
| 78 | + $this->closed = true; |
|
| 79 | + return; |
|
| 80 | + } |
|
| 81 | + |
|
| 82 | + if (false === fwrite($socket, $this->layout->format($event))) { |
|
| 83 | + $this->warn("Error writing to socket. Closing appender."); |
|
| 84 | + $this->closed = true; |
|
| 85 | + } |
|
| 86 | + fclose($socket); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + // ****************************************** |
|
| 90 | + // *** Accessor methods *** |
|
| 91 | + // ****************************************** |
|
| 92 | + |
|
| 93 | + /** Sets the target host. */ |
|
| 94 | + public function setRemoteHost($hostname) { |
|
| 95 | + $this->setString('remoteHost', $hostname); |
|
| 96 | + } |
|
| 97 | + |
|
| 98 | + /** Sets the target port */ |
|
| 99 | + public function setPort($port) { |
|
| 100 | + $this->setPositiveInteger('port', $port); |
|
| 101 | + } |
|
| 102 | 102 | |
| 103 | - /** Sets the timeout. */ |
|
| 104 | - public function setTimeout($timeout) { |
|
| 105 | - $this->setPositiveInteger('timeout', $timeout); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - /** Returns the target host. */ |
|
| 109 | - public function getRemoteHost() { |
|
| 110 | - return $this->getRemoteHost(); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - /** Returns the target port. */ |
|
| 114 | - public function getPort() { |
|
| 115 | - return $this->port; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - /** Returns the timeout */ |
|
| 119 | - public function getTimeout() { |
|
| 120 | - return $this->timeout; |
|
| 121 | - } |
|
| 103 | + /** Sets the timeout. */ |
|
| 104 | + public function setTimeout($timeout) { |
|
| 105 | + $this->setPositiveInteger('timeout', $timeout); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + /** Returns the target host. */ |
|
| 109 | + public function getRemoteHost() { |
|
| 110 | + return $this->getRemoteHost(); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + /** Returns the target port. */ |
|
| 114 | + public function getPort() { |
|
| 115 | + return $this->port; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + /** Returns the timeout */ |
|
| 119 | + public function getTimeout() { |
|
| 120 | + return $this->timeout; |
|
| 121 | + } |
|
| 122 | 122 | } |
@@ -52,59 +52,59 @@ |
||
| 52 | 52 | */ |
| 53 | 53 | class Payone_Log4php_LoggerAppenderDailyFile extends Payone_Log4php_LoggerAppenderFile { |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Format date. |
|
| 57 | - * It follows the {@link PHP_MANUAL#date()} formatting rules and <b>should always be set before {@link $file} param</b>. |
|
| 58 | - * @var string |
|
| 59 | - */ |
|
| 60 | - protected $datePattern = "Ymd"; |
|
| 55 | + /** |
|
| 56 | + * Format date. |
|
| 57 | + * It follows the {@link PHP_MANUAL#date()} formatting rules and <b>should always be set before {@link $file} param</b>. |
|
| 58 | + * @var string |
|
| 59 | + */ |
|
| 60 | + protected $datePattern = "Ymd"; |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Sets date format for the file name. |
|
| 64 | - * @param string $datePattern a regular date() string format |
|
| 65 | - */ |
|
| 66 | - public function setDatePattern($datePattern) { |
|
| 67 | - $this->setString('datePattern', $datePattern); |
|
| 68 | - } |
|
| 62 | + /** |
|
| 63 | + * Sets date format for the file name. |
|
| 64 | + * @param string $datePattern a regular date() string format |
|
| 65 | + */ |
|
| 66 | + public function setDatePattern($datePattern) { |
|
| 67 | + $this->setString('datePattern', $datePattern); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * @return string returns date format for the filename |
|
| 72 | - */ |
|
| 73 | - public function getDatePattern() { |
|
| 74 | - return $this->datePattern; |
|
| 75 | - } |
|
| 70 | + /** |
|
| 71 | + * @return string returns date format for the filename |
|
| 72 | + */ |
|
| 73 | + public function getDatePattern() { |
|
| 74 | + return $this->datePattern; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Similar to parent method, but but replaces "%s" in the file name with |
|
| 79 | - * the current date in format specified by the 'datePattern' parameter. |
|
| 80 | - */ |
|
| 81 | - public function activateOptions() { |
|
| 82 | - $fileName = $this->getFile(); |
|
| 83 | - $date = date($this->getDatePattern()); |
|
| 84 | - $fileName = sprintf($fileName, $date); |
|
| 77 | + /** |
|
| 78 | + * Similar to parent method, but but replaces "%s" in the file name with |
|
| 79 | + * the current date in format specified by the 'datePattern' parameter. |
|
| 80 | + */ |
|
| 81 | + public function activateOptions() { |
|
| 82 | + $fileName = $this->getFile(); |
|
| 83 | + $date = date($this->getDatePattern()); |
|
| 84 | + $fileName = sprintf($fileName, $date); |
|
| 85 | 85 | |
| 86 | - if(!is_file($fileName)) { |
|
| 87 | - $dir = dirname($fileName); |
|
| 88 | - if(!is_dir($dir)) { |
|
| 89 | - mkdir($dir, 0777, true); |
|
| 90 | - } |
|
| 91 | - } |
|
| 86 | + if(!is_file($fileName)) { |
|
| 87 | + $dir = dirname($fileName); |
|
| 88 | + if(!is_dir($dir)) { |
|
| 89 | + mkdir($dir, 0777, true); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | - $this->fp = fopen($fileName, ($this->getAppend()? 'a':'w')); |
|
| 94 | - if($this->fp) { |
|
| 95 | - if(flock($this->fp, LOCK_EX)) { |
|
| 96 | - if($this->getAppend()) { |
|
| 97 | - fseek($this->fp, 0, SEEK_END); |
|
| 98 | - } |
|
| 99 | - fwrite($this->fp, $this->layout->getHeader()); |
|
| 100 | - flock($this->fp, LOCK_UN); |
|
| 101 | - $this->closed = false; |
|
| 102 | - } else { |
|
| 103 | - // TODO: should we take some action in this case? |
|
| 104 | - $this->closed = true; |
|
| 105 | - } |
|
| 106 | - } else { |
|
| 107 | - $this->closed = true; |
|
| 108 | - } |
|
| 109 | - } |
|
| 93 | + $this->fp = fopen($fileName, ($this->getAppend()? 'a':'w')); |
|
| 94 | + if($this->fp) { |
|
| 95 | + if(flock($this->fp, LOCK_EX)) { |
|
| 96 | + if($this->getAppend()) { |
|
| 97 | + fseek($this->fp, 0, SEEK_END); |
|
| 98 | + } |
|
| 99 | + fwrite($this->fp, $this->layout->getHeader()); |
|
| 100 | + flock($this->fp, LOCK_UN); |
|
| 101 | + $this->closed = false; |
|
| 102 | + } else { |
|
| 103 | + // TODO: should we take some action in this case? |
|
| 104 | + $this->closed = true; |
|
| 105 | + } |
|
| 106 | + } else { |
|
| 107 | + $this->closed = true; |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | 110 | } |
@@ -83,17 +83,17 @@ |
||
| 83 | 83 | $date = date($this->getDatePattern()); |
| 84 | 84 | $fileName = sprintf($fileName, $date); |
| 85 | 85 | |
| 86 | - if(!is_file($fileName)) { |
|
| 86 | + if (!is_file($fileName)) { |
|
| 87 | 87 | $dir = dirname($fileName); |
| 88 | - if(!is_dir($dir)) { |
|
| 88 | + if (!is_dir($dir)) { |
|
| 89 | 89 | mkdir($dir, 0777, true); |
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $this->fp = fopen($fileName, ($this->getAppend()? 'a':'w')); |
|
| 94 | - if($this->fp) { |
|
| 95 | - if(flock($this->fp, LOCK_EX)) { |
|
| 96 | - if($this->getAppend()) { |
|
| 93 | + $this->fp = fopen($fileName, ($this->getAppend() ? 'a' : 'w')); |
|
| 94 | + if ($this->fp) { |
|
| 95 | + if (flock($this->fp, LOCK_EX)) { |
|
| 96 | + if ($this->getAppend()) { |
|
| 97 | 97 | fseek($this->fp, 0, SEEK_END); |
| 98 | 98 | } |
| 99 | 99 | fwrite($this->fp, $this->layout->getHeader()); |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class Payone_Log4php_LoggerPatternConverterLevel extends Payone_Log4php_LoggerPatternConverter { |
| 28 | 28 | |
| 29 | - public function convert(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 30 | - return $event->getLevel()->toString(); |
|
| 31 | - } |
|
| 29 | + public function convert(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 30 | + return $event->getLevel()->toString(); |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -29,5 +29,5 @@ |
||
| 29 | 29 | * @subpackage pattern |
| 30 | 30 | */ |
| 31 | 31 | class Payone_Log4php_LoggerPatternConverterRequest extends Payone_Log4php_LoggerPatternConverterSuperglobal { |
| 32 | - protected $name = '_REQUEST'; |
|
| 32 | + protected $name = '_REQUEST'; |
|
| 33 | 33 | } |
| 34 | 34 | \ No newline at end of file |
@@ -26,51 +26,51 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class Payone_Log4php_LoggerThrowableInformation { |
| 28 | 28 | |
| 29 | - /** @var Exception Throwable to log */ |
|
| 30 | - private $throwable; |
|
| 29 | + /** @var Exception Throwable to log */ |
|
| 30 | + private $throwable; |
|
| 31 | 31 | |
| 32 | - /** @var array Array of throwable messages */ |
|
| 33 | - private $throwableArray; |
|
| 32 | + /** @var array Array of throwable messages */ |
|
| 33 | + private $throwableArray; |
|
| 34 | 34 | |
| 35 | - /** @var Logger reference */ |
|
| 36 | - private $logger; |
|
| 35 | + /** @var Logger reference */ |
|
| 36 | + private $logger; |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * Create a new instance |
|
| 40 | - * |
|
| 41 | - * @param $throwable - a throwable as a exception |
|
| 42 | - * @param $logger - Logger reference |
|
| 43 | - */ |
|
| 44 | - public function __construct(Exception $throwable) { |
|
| 45 | - $this->throwable = $throwable; |
|
| 46 | - } |
|
| 38 | + /** |
|
| 39 | + * Create a new instance |
|
| 40 | + * |
|
| 41 | + * @param $throwable - a throwable as a exception |
|
| 42 | + * @param $logger - Logger reference |
|
| 43 | + */ |
|
| 44 | + public function __construct(Exception $throwable) { |
|
| 45 | + $this->throwable = $throwable; |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Return source exception |
|
| 50 | - * |
|
| 51 | - * @return Exception |
|
| 52 | - */ |
|
| 53 | - public function getThrowable() { |
|
| 54 | - return $this->throwable; |
|
| 55 | - } |
|
| 48 | + /** |
|
| 49 | + * Return source exception |
|
| 50 | + * |
|
| 51 | + * @return Exception |
|
| 52 | + */ |
|
| 53 | + public function getThrowable() { |
|
| 54 | + return $this->throwable; |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @desc Returns string representation of throwable |
|
| 59 | - * |
|
| 60 | - * @return array |
|
| 61 | - */ |
|
| 62 | - public function getStringRepresentation() { |
|
| 63 | - if (!is_array($this->throwableArray)) { |
|
| 64 | - $renderer = Payone_Log4php_Logger::getHierarchy()->getRendererMap()->getByClassName(get_class($this->throwable)); |
|
| 57 | + /** |
|
| 58 | + * @desc Returns string representation of throwable |
|
| 59 | + * |
|
| 60 | + * @return array |
|
| 61 | + */ |
|
| 62 | + public function getStringRepresentation() { |
|
| 63 | + if (!is_array($this->throwableArray)) { |
|
| 64 | + $renderer = Payone_Log4php_Logger::getHierarchy()->getRendererMap()->getByClassName(get_class($this->throwable)); |
|
| 65 | 65 | |
| 66 | - // TODO: why this? |
|
| 67 | - if ($renderer instanceof Payone_Log4php_LoggerRendererDefault) { |
|
| 68 | - $renderer = new Payone_Log4php_LoggerRendererException(); |
|
| 69 | - } |
|
| 70 | - $this->throwableArray = explode("\n", $renderer->render($this->throwable)); |
|
| 71 | - } |
|
| 66 | + // TODO: why this? |
|
| 67 | + if ($renderer instanceof Payone_Log4php_LoggerRendererDefault) { |
|
| 68 | + $renderer = new Payone_Log4php_LoggerRendererException(); |
|
| 69 | + } |
|
| 70 | + $this->throwableArray = explode("\n", $renderer->render($this->throwable)); |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | - return $this->throwableArray; |
|
| 74 | - } |
|
| 73 | + return $this->throwableArray; |
|
| 74 | + } |
|
| 75 | 75 | } |
| 76 | 76 | ?> |
| 77 | 77 | \ No newline at end of file |
@@ -41,7 +41,7 @@ |
||
| 41 | 41 | * @param $throwable - a throwable as a exception |
| 42 | 42 | * @param $logger - Logger reference |
| 43 | 43 | */ |
| 44 | - public function __construct(Exception $throwable) { |
|
| 44 | + public function __construct(Exception $throwable) { |
|
| 45 | 45 | $this->throwable = $throwable; |
| 46 | 46 | } |
| 47 | 47 | |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | */ |
| 27 | 27 | class Payone_Log4php_LoggerPatternConverterMessage extends Payone_Log4php_LoggerPatternConverter { |
| 28 | 28 | |
| 29 | - public function convert(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 30 | - return $event->getRenderedMessage(); |
|
| 31 | - } |
|
| 29 | + public function convert(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 30 | + return $event->getRenderedMessage(); |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -41,45 +41,45 @@ |
||
| 41 | 41 | * @subpackage appenders |
| 42 | 42 | */ |
| 43 | 43 | class Payone_Log4php_LoggerAppenderEcho extends Payone_Log4php_LoggerAppender { |
| 44 | - /** boolean used internally to mark first append */ |
|
| 45 | - protected $firstAppend = true; |
|
| 44 | + /** boolean used internally to mark first append */ |
|
| 45 | + protected $firstAppend = true; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * If set to true, a <br /> element will be inserted before each line |
|
| 49 | - * break in the logged message. Default value is false. @var boolean |
|
| 50 | - */ |
|
| 51 | - protected $htmlLineBreaks = false; |
|
| 47 | + /** |
|
| 48 | + * If set to true, a <br /> element will be inserted before each line |
|
| 49 | + * break in the logged message. Default value is false. @var boolean |
|
| 50 | + */ |
|
| 51 | + protected $htmlLineBreaks = false; |
|
| 52 | 52 | |
| 53 | - public function close() { |
|
| 54 | - if($this->closed != true) { |
|
| 55 | - if(!$this->firstAppend) { |
|
| 56 | - echo $this->layout->getFooter(); |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - $this->closed = true; |
|
| 60 | - } |
|
| 53 | + public function close() { |
|
| 54 | + if($this->closed != true) { |
|
| 55 | + if(!$this->firstAppend) { |
|
| 56 | + echo $this->layout->getFooter(); |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + $this->closed = true; |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 63 | - if($this->layout !== null) { |
|
| 64 | - if($this->firstAppend) { |
|
| 65 | - echo $this->layout->getHeader(); |
|
| 66 | - $this->firstAppend = false; |
|
| 67 | - } |
|
| 68 | - $text = $this->layout->format($event); |
|
| 62 | + public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 63 | + if($this->layout !== null) { |
|
| 64 | + if($this->firstAppend) { |
|
| 65 | + echo $this->layout->getHeader(); |
|
| 66 | + $this->firstAppend = false; |
|
| 67 | + } |
|
| 68 | + $text = $this->layout->format($event); |
|
| 69 | 69 | |
| 70 | - if ($this->htmlLineBreaks) { |
|
| 71 | - $text = nl2br($text); |
|
| 72 | - } |
|
| 73 | - echo $text; |
|
| 74 | - } |
|
| 75 | - } |
|
| 70 | + if ($this->htmlLineBreaks) { |
|
| 71 | + $text = nl2br($text); |
|
| 72 | + } |
|
| 73 | + echo $text; |
|
| 74 | + } |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - public function setHtmlLineBreaks($value) { |
|
| 78 | - $this->setBoolean('htmlLineBreaks', $value); |
|
| 79 | - } |
|
| 77 | + public function setHtmlLineBreaks($value) { |
|
| 78 | + $this->setBoolean('htmlLineBreaks', $value); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - public function getHtmlLineBreaks() { |
|
| 82 | - return $this->htmlLineBreaks; |
|
| 83 | - } |
|
| 81 | + public function getHtmlLineBreaks() { |
|
| 82 | + return $this->htmlLineBreaks; |
|
| 83 | + } |
|
| 84 | 84 | } |
| 85 | 85 | |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | protected $htmlLineBreaks = false; |
| 52 | 52 | |
| 53 | 53 | public function close() { |
| 54 | - if($this->closed != true) { |
|
| 55 | - if(!$this->firstAppend) { |
|
| 54 | + if ($this->closed != true) { |
|
| 55 | + if (!$this->firstAppend) { |
|
| 56 | 56 | echo $this->layout->getFooter(); |
| 57 | 57 | } |
| 58 | 58 | } |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function append(Payone_Log4php_LoggerLoggingEvent $event) { |
| 63 | - if($this->layout !== null) { |
|
| 64 | - if($this->firstAppend) { |
|
| 63 | + if ($this->layout !== null) { |
|
| 64 | + if ($this->firstAppend) { |
|
| 65 | 65 | echo $this->layout->getHeader(); |
| 66 | 66 | $this->firstAppend = false; |
| 67 | 67 | } |
@@ -43,14 +43,14 @@ |
||
| 43 | 43 | */ |
| 44 | 44 | class Payone_Log4php_LoggerFilterDenyAll extends Payone_Log4php_LoggerFilter { |
| 45 | 45 | |
| 46 | - /** |
|
| 47 | - * Always returns the integer constant {@link LoggerFilter::DENY} |
|
| 48 | - * regardless of the {@link LoggerLoggingEvent} parameter. |
|
| 49 | - * |
|
| 50 | - * @param Payone_Log4php_LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to filter. |
|
| 51 | - * @return LoggerFilter::DENY Always returns {@link LoggerFilter::DENY} |
|
| 52 | - */ |
|
| 53 | - public function decide(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 54 | - return Payone_Log4php_LoggerFilter::DENY; |
|
| 55 | - } |
|
| 46 | + /** |
|
| 47 | + * Always returns the integer constant {@link LoggerFilter::DENY} |
|
| 48 | + * regardless of the {@link LoggerLoggingEvent} parameter. |
|
| 49 | + * |
|
| 50 | + * @param Payone_Log4php_LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to filter. |
|
| 51 | + * @return LoggerFilter::DENY Always returns {@link LoggerFilter::DENY} |
|
| 52 | + */ |
|
| 53 | + public function decide(Payone_Log4php_LoggerLoggingEvent $event) { |
|
| 54 | + return Payone_Log4php_LoggerFilter::DENY; |
|
| 55 | + } |
|
| 56 | 56 | } |