From d0997234b6fde134d6338fdd4aadb023cc9ec9d4 Mon Sep 17 00:00:00 2001 From: Paul Wilde Date: Mon, 25 Nov 2024 11:56:01 +0000 Subject: [PATCH] added datetime to log file --- norg/config/init.nim | 3 +++ norg/model/log_type.nim | 2 +- todo.md | 6 +++--- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/norg/config/init.nim b/norg/config/init.nim index 19011ee..9cb0de6 100644 --- a/norg/config/init.nim +++ b/norg/config/init.nim @@ -70,6 +70,9 @@ proc addExclusions*(current: var Exclusions, exc_conf: TomlValueRef) = current.patterns.add(p.getStr()) proc parseConfigFile*(file: string): NorgConfig = + if not fileExists(file): + echo "No Config File provided or file does not exist." + return NorgConfig() let in_conf = parsetoml.parseFile(file) norg_config.source_directories = parseSourceDirectories(in_conf) # Add config file to backup diff --git a/norg/model/log_type.nim b/norg/model/log_type.nim index 0ceccf5..0391f7b 100644 --- a/norg/model/log_type.nim +++ b/norg/model/log_type.nim @@ -14,7 +14,7 @@ proc initLogger*(level: Level = lvlInfo, strfmt: string = "[$levelname] ", log_f logger = newConsoleLogger(level, strfmt) logger.log(lvlNotice, "Log Level: ", $level) if log_file != "": - let str = "$time " & strfmt + let str = "$datetime " & strfmt filelogger = newFileLogger(log_file, levelThreshold=level, fmtStr=str) filelogger.log(lvlNotice, "Log Level: ", $level) diff --git a/todo.md b/todo.md index ecdbd63..d66b344 100644 --- a/todo.md +++ b/todo.md @@ -4,9 +4,9 @@ - [x] Pre and post run scripts i.e. to backup a database - [x] change encryption_password to encryption_passphrase in config to be more in line with borgbackup - [ ] More notifiers (ntfy, healthchecks, etc.) -- [ ] Generate config command parameter +- [x] Generate config command parameter - [x] Allow to specify direct repository so mount/extract doesn't fail if multiple are available - [ ] Better workflow of using borg flags and options as it seems a little sketchy just passing them through to the command string -- [ ] Add Windows support (Restic Only) -- [ ] Include/Exclude files functionality +- [x] Add Windows support (Restic Only) +- [x] Include/Exclude files functionality - [ ] ... and loads more