diff --git a/library/log4php/pattern/LoggerPatternConverterClass.php b/library/log4php/pattern/LoggerPatternConverterClass.php new file mode 100644 --- /dev/null +++ b/library/log4php/pattern/LoggerPatternConverterClass.php @@ -0,0 +1,62 @@ +option) && is_numeric($this->option) && $this->option >= 0) { + $this->length = (integer)$this->option; + } + } + + public function convert(LoggerLoggingEvent $event) { + $name = $event->getLocationInformation()->getClassName(); + + if (!isset($this->cache[$name])) { + + // If length is set return shortened class name + if (isset($this->length)) { + $this->cache[$name] = LoggerUtils::shortenClassName($name, $this->length); + } // If no length is specified return the full class name + else { + $this->cache[$name] = $name; + } + } + + return $this->cache[$name]; + } +} + \ No newline at end of file