From ea18b8b9b35f0d2e83122ebe20739ec4207b96e8 Mon Sep 17 00:00:00 2001 From: Jens True Date: Tue, 4 Jul 2023 10:15:34 +0000 Subject: [PATCH] More logging. --- config.example.yml | 2 +- src/App.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/config.example.yml b/config.example.yml index d5d4664..51ef4a3 100644 --- a/config.example.yml +++ b/config.example.yml @@ -2,7 +2,7 @@ notification: - type: Ntfy domain: https://ntfy.jcktrue.dk topic: backup -log: output.log +log: output.log rclone: options: bwlimit: 6M diff --git a/src/App.php b/src/App.php index 20814d8..795e61d 100644 --- a/src/App.php +++ b/src/App.php @@ -53,7 +53,7 @@ class App function (string $path): bool { return touch($path); } - )->required(), + ), 'templates' => Expect::structure(['notify' => Expect::string()]) ]); @@ -61,12 +61,13 @@ class App $parsedConfig = $parser->parseFile($configFile); - // Merge those values into your configuration schema: + // Merge those values into the configuration schema: $this->config->merge($parsedConfig); $logger = new Logger('app'); if ($this->config->get('log')) { $logger->pushHandler(new StreamHandler($this->config->get('log'))); + $logger->info("Logging enabled"); } $logger->info("Initialization complete"); @@ -81,7 +82,9 @@ class App */ public function getConfig(string $key): mixed { - return $this->config->get($key); + $ret = $this->config->get($key); + $this->logger->debug("Fetching configuration key",[$key,$ret]); + return $ret; } /**