logger.class.php 645 B

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. use Nekonomokochan\PhpJsonLogger\Logger;
  3. use Nekonomokochan\PhpJsonLogger\LoggerBuilder;
  4. class OrganizrLogger extends LoggerBuilder
  5. {
  6. public $isReady;
  7. /**
  8. * @return string
  9. */
  10. public function getReadyStatus(): bool
  11. {
  12. return $this->isReady;
  13. }
  14. /**
  15. * @param string $traceId
  16. */
  17. public function setReadyStatus(bool $readyStatus)
  18. {
  19. $this->isReady = $readyStatus;
  20. }
  21. public function build(): Logger
  22. {
  23. if (!$this->isReady) {
  24. $this->setChannel(self::DEFAULT_CHANNEL);
  25. $this->setLogLevel(self::INFO);
  26. $this->setFileName('/tmp/organizr-temp.log');
  27. $this->setMaxFiles(1);
  28. }
  29. return new Logger($this);
  30. }
  31. }