getRotatingLogger

@param string $channel
@param string $level
@param int    $maxFiles

@return  LoggerInterface
@throws \Exception
504424
public function createRotatingLogger($channel, $level = Logger::DEBUG, $maxFiles = 7): LoggerInterface
    {
        return $this->createLogger(
            $channel,
            $level,
            new RotatingFileHandler($this->getLogFile($channel), $maxFiles, $level)
        );
    }
1193313
public function createCategory(string $channel, ?string $level = null): LoggerInterface
    {
        return $this->createChannel($channel, $level);
    }
83367
public function useRotatingFiles($level = Logger::DEBUG, $filename = null)
    {
        $filename || $filename = $this->name.'.log';
        $path = $this->settings['directory'].'/'.$filename;
        $this->monolog->pushHandler(
            $handler = new Handler\RotatingFileHandler($path, 5, $level)
        );
        $handler->setFormatter($this->getDefaultFormatter());

        return $this;
    }
267791
public function createChannel(string $channel, ?string $level = null): LoggerInterface
    {
        return $this->getLogger($channel, $level);
    }
608315
public function useFiles($level = Monolog::DEBUG, $rotate = null)
    {
        $rotate = is_bool($rotate) ? $rotate : $this->settings['rotate'];
        $filepath = $this->settings['directory'].$this->name.'.log';
        $handler = $rotate
            ? new Handler\RotatingFileHandler($filepath, 5, $level)
            : new Handler\StreamHandler($filepath, $level);

        $this->monolog->pushHandler($handler);

        $handler->setFormatter($this->getDefaultFormatter());
    }
1231807
public static function getLogger($level = null)
    {
        if (empty($level)) {
            $level = static::DEFAULT_LEVEL;
        }

        if (empty(static::$logger)) {
            static::setLogger($level);
        }

        return static::$logger;
    }
631654
public function log($level, $message, array $context = [])
    {
        if (count($this->handlers) === 0) {
            throw new RuntimeException('You must define at least one logging handler, none provided.');
        }

        foreach ($this->handlers as $handler) {

            $this->logs[] = sprintf('[%s] %s', $level, $message);

            $handler->write($level, $message, $context);
        }

        return $this;
    }
1233729
public static function setLogger($level = null, $logger = null)
    {
        if (empty($level)) {
            $level = static::DEFAULT_LEVEL;
        }

        if (!empty($logger)) {
            static::$logger = $logger;
            return;
        }

        static::$logger = new \Monolog\Logger("log");

        $handler = static::getHandler($level);
        static::$logger->pushHandler($handler);

        $processor = static::getProcessor();
        static::$logger->pushProcessor($processor);
    }
1227826
public function log($level, $message, array $context = array())
    {
        if($context != []){
            /** @var DumpFile $dumpFile */
            $dumpFile = true;

            $t = $this->logFile->log($message, $level, $dumpFile);
            $dumpFile->writeSerialized($context);
        } else {
            $t = $this->logFile->log($message, $level);
        }

        return $t;

    }
1214943
protected function write($message, $level, array $parameters)
    {
        if ($this->enabled === false) {
            return null;
        }
        
        if ($this->log_request_identifier === null) {
            $this->log_request_identifier = "MISSING_REQUEST_ID";
        }

        $ExceptionToTrace = $message;
        if ($message instanceof \Exception) {
            $message = (string) $message; //casting to string will append exception name
        }
        
        $LogDate = ($this->getFactory()->buildDateTime(null, $this->getLogDateTimeZone()));
        $Filename = $this->getFilenameByLevel($level);

        if ($Filename->isFile() && $Filename->isWritable() === false) {
            return $LogDate;
        }

        $this->logRotate($Filename);
        
        $this->write_count++;
        $request_id = substr($this->log_request_identifier, 0, 6);
        $trace_id =  substr(md5(uniqid()), 0, 6);
        $write_count = $this->write_count;
        $id = "$request_id/$trace_id ($write_count)";

        $message = empty($parameters) === false ? vsprintf($message, $parameters) : $message;
        $message = $LogDate->format($this->getLogDateFormat())." ${id} ".$message;

        if ($ExceptionToTrace instanceof \Exception) {
            $trace = $ExceptionToTrace->getTraceAsString().$this->getPreviousTraceDump($ExceptionToTrace->getPrevious());
            if ($trace !== '') {
                $message .= "\n".$trace."\n";
            }
        }

        if (is_dir($Filename->getPath()) === false) {
            @mkdir($Filename->getPath(), 0775, true);
        }
        
        @error_log($message."\n", 3, $Filename->getPathname());
        
        return $LogDate;
    }
179330
public function log($level, $message, array $context = array()) {
		try {
			if($this->messageType === null) {
				error_log($message);
			} elseif((int)$this->messageType === 0 || (int)$this->messageType === 4) {
				error_log($message, $this->messageType);
			} else {
				error_log($message, (int)$this->messageType, $this->destination, $this->extraHeaders);
			}
		} catch(\Exception $e) {
		}
	}
516486
public static function getLogger($channel)
    {
        $callback = self::$callback;
        if (null === $callback) {
            return new NullLogger();
        }

        $logger = $callback($channel);
        if ($logger instanceof LoggerInterface) {
            return $logger;
        }

        throw new RuntimeException('Callback did not return an instance of \Psr\Log\LoggerInterface!');
    }
801708
public function findLogsThroughConfigs($configs, $maxResult = -1)
    {
        if ($configs === null || count($configs) == 0) {
            return null;
        }

        $queryBuilder = $this
            ->createQueryBuilder('log')
            ->leftJoin('log.workspace', 'workspace')
            ->orderBy('log.dateLog', 'DESC');

        $queryBuilder = $this->addConfigurationFilterToQueryBuilder($queryBuilder, $configs);

        if ($maxResult > 0) {
            $queryBuilder->setMaxResults($maxResult);
        }

        return $queryBuilder->getQuery();
    }
925870
public function log($level, $msg)
    {
        $msg = implode("\n", $msg);

        switch ($level) {
        case LOG_DEBUG:
        case LOG_INFO:
        case LOG_NOTICE:
            if ($this->config['debug']) {
                rcube::write_log('ldap', $msg);
            }
            break;

        case LOG_EMERGE:
        case LOG_ALERT:
        case LOG_CRIT:
            rcube::raise_error($msg, true, true);
            break;

        case LOG_ERR:
        case LOG_WARNING:
            $this->error = $msg;
            rcube::raise_error($msg, true, false);
            break;
        }
    }
1281260
private static function log(string $message, int $level) {
        \Logger::configure(self::getConfiguration());
        $logger = \Logger::getRootLogger();
        $logger->setLevel(self::getLoggerLevel());

        switch ($level) {
            case Logger::DEBUG:
                $logger->debug($message);
                break;
            case Logger::INFO:
                $logger->info($message);
                break;
            case Logger::WARN:
                $logger->warn($message);
                break;
            case Logger::ERROR:
                $logger->error($message);
                break;
            case Logger::FATAL:
                $logger->fatal($message);
                break;
            case Logger::TRACE:
                $logger->trace($message);
                break;
            default:
        }
    }
164934
final public static function logLevelToSyslog($level)
    {
        $origLevel = $level;

        if (is_numeric($level)) {
            $level = intval($level);
            if ($level < 8 && $level > -1) {
                return $level;
            }
        } elseif (is_string($level)) {
            $level = strtolower($level);
            $syslogLevel = array_search($level, self::$psrLevels);
            if (false !== $syslogLevel) {
                return $syslogLevel;
            }
        }

        throw new RuntimeException(
            sprintf("Cannot convert log-level '%s' to syslog-style", $origLevel)
        );
    }
800647
private static function _getLoggerLevel1($loggerParams) {
        if (!isset(self::$loggerLevel1)) {
            $CymapgtLevel1LogDir = $loggerParams['log_dir'];
            $CymapgtLevel1Stream = new StreamHandler($CymapgtLevel1LogDir, MonologLogger::DEBUG);
            $CymapgtLevel1Logger = new MonologLogger('cymapgt_level1');
            $CymapgtLevel1Logger->pushHandler($CymapgtLevel1Stream);
            self::$loggerLevel1 = $CymapgtLevel1Logger;
        }
        return self::$loggerLevel1;
    }