From 1f0cc52389f1030c122da0f2cb3f3c3451254569 Mon Sep 17 00:00:00 2001 From: Felix Bruns Date: Thu, 9 May 2024 19:12:52 +0200 Subject: [PATCH] Create log file if required --- lib/logger.dart | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/logger.dart b/lib/logger.dart index 920d20b..cfbb3ca 100644 --- a/lib/logger.dart +++ b/lib/logger.dart @@ -8,11 +8,13 @@ class Log { static Logger _logger = Logger(); factory Log() { + final logFile = File("/var/log/proxmox-dash/proxmox-dash.log"); + if (!logFile.existsSync()) { + logFile.createSync(recursive: true); + } + _logger = Logger( - output: MultiOutput([ - ConsoleOutput(), - FileOutput(file: File("/var/log/proxmox-dash/proxmox-dash.log")), - ]), + output: FileOutput(file: logFile), level: Level.info, ); return _instance;