From cf912dad6da58bbbe2135a806928d87989017d59 Mon Sep 17 00:00:00 2001 From: Netkas Date: Thu, 6 Jul 2023 18:05:21 -0400 Subject: [PATCH] `\TamerLib\Classes\ > RedisServer > start()` now starts the server with a matching logging level to `net.nosial.loglib` --- CHANGELOG.md | 6 ++++++ src/TamerLib/Classes/RedisServer.php | 14 +++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a2062ad..73113c8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [2.0.2] - Unreleased + +### Changed + - `\TamerLib\Classes\ > RedisServer > start()` now starts the server with a matching logging level to `net.nosial.loglib` + + ## [2.0.1] - 2023-06-30 Minor bugfixes and improvements. diff --git a/src/TamerLib/Classes/RedisServer.php b/src/TamerLib/Classes/RedisServer.php index 7f0808a..20dac95 100644 --- a/src/TamerLib/Classes/RedisServer.php +++ b/src/TamerLib/Classes/RedisServer.php @@ -4,6 +4,7 @@ namespace TamerLib\Classes; + use LogLib\Abstracts\LevelType; use LogLib\Log; use Redis; use RedisException; @@ -74,7 +75,18 @@ } Log::verbose(Utilities::getName(), 'Starting server on port ' . $this->configuration->getPort() . '.'); - $this->server_process = new Process([$this->cmd, '--port', $this->configuration->getPort()]); + + $log_level = match (\LogLib\Classes\Utilities::getLogLevel()) + { + LevelType::Warning, LevelType::Error => 'warning', + LevelType::Verbose => 'verbose', + LevelType::Debug => 'debug', + default => 'notice', + }; + + $this->server_process = new Process([ + $this->cmd, '--port', $this->configuration->getPort(), '--loglevel', $log_level + ]); $this->server_process->start(); // Use a redis client and ping the server until it responds.