diff --git a/.idea/php.xml b/.idea/php.xml index 61d556b..345f3d3 100644 --- a/.idea/php.xml +++ b/.idea/php.xml @@ -11,9 +11,10 @@ + + - diff --git a/CHANGELOG.md b/CHANGELOG.md index e677549..9c066af 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,15 @@ 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). +## [1.1.7] - 2025-03-14 + +This update introduces minor changes + +### Changed + - Updated remote references for dependencies + - Updated Library to use net.nosial.loglib2 instead of the now deprecated net.nosial.loglib + + ## [1.1.6] - 2025-01-07 This update introduces minor improvements diff --git a/project.json b/project.json index 3d235f4..1d0d339 100644 --- a/project.json +++ b/project.json @@ -24,7 +24,7 @@ "description": "ConfigLib is a library for reading and writing configuration files via the NCC Runtime API", "company": "Nosial", "copyright": "Copyright (c) 2022-2023 Nosial", - "version": "1.1.6", + "version": "1.1.7", "uuid": "9347259e-8e4d-11ed-85a7-fd07cf28ef35" }, "build": { @@ -38,12 +38,12 @@ { "name": "net.nosial.optslib", "version": "latest", - "source": "nosial/libs.opts=latest@n64" + "source": "nosial/optslib=latest@github" }, { - "name": "net.nosial.loglib", + "name": "net.nosial.loglib2", "version": "latest", - "source": "nosial/libs.log=latest@n64" + "source": "nosial/loglib2=latest@github" }, { "name": "com.symfony.filesystem", diff --git a/src/ConfigLib/Configuration.php b/src/ConfigLib/Configuration.php index 77005d8..dddb5b1 100644 --- a/src/ConfigLib/Configuration.php +++ b/src/ConfigLib/Configuration.php @@ -3,13 +3,19 @@ namespace ConfigLib; use Exception; - use LogLib\Log; + use LogLib2\Logger; use RuntimeException; use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Yaml\Yaml; class Configuration { + /** + * The logger of the class + * @var Logger + */ + private Logger $logger; + /** * The name of the configuration * @var string|array @@ -42,6 +48,8 @@ */ public function __construct(string $name='default', ?string $path=null) { + $this->logger = new Logger('net.nosial.configlib'); + // Sanitize $name for a file path $name = strtolower($name); $name = str_replace(array('/', '\\', '.'), '_', $name); @@ -56,7 +64,7 @@ } else { - Log::warning('net.nosial.configlib', sprintf('Environment variable "%s" points to a non-existent file, resorting to default/builtin configuration', $env)); + $this->logger->warning(sprintf('Environment variable "%s" points to a non-existent file, resorting to default/builtin configuration', $env)); } } @@ -131,7 +139,7 @@ if (!$configDir) { - Log::warning('net.nosial.configlib', sprintf('Unable to find a proper directory to store configuration paths in, using temporary directory instead: %s', sys_get_temp_dir())); + $this->logger->warning(sprintf('Unable to find a proper directory to store configuration paths in, using temporary directory instead: %s', sys_get_temp_dir())); $configDir = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'configlib'; } } @@ -163,7 +171,7 @@ } catch(Exception $e) { - Log::error('net.nosial.configlib', sprintf('Unable to load configuration "%s", %s', $this->name, $e->getMessage())); + $this->logger->error(sprintf('Unable to load configuration "%s", %s', $this->name, $e->getMessage()), $e); throw new RuntimeException(sprintf('Unable to load configuration "%s"', $this->name), $e); } } @@ -355,7 +363,7 @@ } $this->modified = false; - Log::debug('net.nosial.configlib', sprintf('Configuration "%s" saved', $this->name)); + $this->logger->debug(sprintf('Configuration "%s" saved', $this->name)); } /** @@ -437,7 +445,7 @@ } $this->modified = false; - Log::debug('net.nosial.configlib', 'Loaded configuration file: ' . $this->path); + $this->logger->debug('Loaded configuration file: ' . $this->path); } /** @@ -495,7 +503,7 @@ } catch(Exception $e) { - Log::error('net.nosial.configlib', sprintf('Unable to save configuration "%s" to disk, %s', $this->name, $e->getMessage())); + $this->logger->error(sprintf('Unable to save configuration "%s" to disk, %s', $this->name, $e->getMessage()), $e); } } }