فهرست منبع

added logger.class.php

CauseFX 4 سال پیش
والد
کامیت
d9c7f6515c
1فایلهای تغییر یافته به همراه36 افزوده شده و 0 حذف شده
  1. 36 0
      api/classes/logger.class.php

+ 36 - 0
api/classes/logger.class.php

@@ -0,0 +1,36 @@
+<?php
+
+use Nekonomokochan\PhpJsonLogger\Logger;
+use Nekonomokochan\PhpJsonLogger\LoggerBuilder;
+
+class OrganizrLogger extends LoggerBuilder
+{
+	public $isReady;
+	
+	/**
+	 * @return string
+	 */
+	public function getReadyStatus(): bool
+	{
+		return $this->isReady;
+	}
+	
+	/**
+	 * @param string $traceId
+	 */
+	public function setReadyStatus(bool $readyStatus)
+	{
+		$this->isReady = $readyStatus;
+	}
+	
+	public function build(): Logger
+	{
+		if (!$this->isReady) {
+			$this->setChannel(self::DEFAULT_CHANNEL);
+			$this->setLogLevel(self::INFO);
+			$this->setFileName('/tmp/organizr-temp.log');
+			$this->setMaxFiles(1);
+		}
+		return new Logger($this);
+	}
+}