added datetime to log file

This commit is contained in:
Paul Wilde 2024-11-25 11:56:01 +00:00
parent 160cf2a534
commit d0997234b6
3 changed files with 7 additions and 4 deletions

View file

@ -70,6 +70,9 @@ proc addExclusions*(current: var Exclusions, exc_conf: TomlValueRef) =
current.patterns.add(p.getStr()) current.patterns.add(p.getStr())
proc parseConfigFile*(file: string): NorgConfig = 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) let in_conf = parsetoml.parseFile(file)
norg_config.source_directories = parseSourceDirectories(in_conf) norg_config.source_directories = parseSourceDirectories(in_conf)
# Add config file to backup # Add config file to backup

View file

@ -14,7 +14,7 @@ proc initLogger*(level: Level = lvlInfo, strfmt: string = "[$levelname] ", log_f
logger = newConsoleLogger(level, strfmt) logger = newConsoleLogger(level, strfmt)
logger.log(lvlNotice, "Log Level: ", $level) logger.log(lvlNotice, "Log Level: ", $level)
if log_file != "": if log_file != "":
let str = "$time " & strfmt let str = "$datetime " & strfmt
filelogger = newFileLogger(log_file, levelThreshold=level, fmtStr=str) filelogger = newFileLogger(log_file, levelThreshold=level, fmtStr=str)
filelogger.log(lvlNotice, "Log Level: ", $level) filelogger.log(lvlNotice, "Log Level: ", $level)

View file

@ -4,9 +4,9 @@
- [x] Pre and post run scripts i.e. to backup a database - [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 - [x] change encryption_password to encryption_passphrase in config to be more in line with borgbackup
- [ ] More notifiers (ntfy, healthchecks, etc.) - [ ] 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 - [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 - [ ] 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) - [x] Add Windows support (Restic Only)
- [ ] Include/Exclude files functionality - [x] Include/Exclude files functionality
- [ ] ... and loads more - [ ] ... and loads more