diff --git a/Config.toml b/Config.toml index 320598b..3063d2d 100644 --- a/Config.toml +++ b/Config.toml @@ -4,6 +4,7 @@ SafeMode = 1 SilentMode = 0 CheckInput = 3 DotFiles = 0 +Logging = 1 [Variables] NextNum = "!" @@ -20,9 +21,9 @@ Second = "[s]" VarCall = "%%" [DirectoryPaths] -RootDir = ["Unset"] -InputDir = [ "%RootDir%",] -OutputDir = [ "%RootDir%/Output",] +RootDir = "Unset" +InputDir = [ "%RootDir%"] +OutputDir = [ "%RootDir%/Output"] LogDir = "%RootDir%/.Logs" FailedDir = "%RootDir%/.Failed" diff --git a/SaraSortd.py b/SaraSortd.py index 93223cb..72d1aec 100644 --- a/SaraSortd.py +++ b/SaraSortd.py @@ -207,12 +207,13 @@ def Dir(Path, Output = True, CopyConf = True): def LogWrite(Text): - if (ConfDirs["LogDir"] != None and ConfNames != "Unset"): - if (ConfNames["LogFileName"] != None and ConfNames["LogFileName"] != "Unset"): - Dir(Parse(String = ConfDirs["LogDir"], Path = ConfPath), Output = False, CopyConf = False) - LogFile = f"{Parse(String = ConfDirs["LogDir"], Path = ConfPath)}/{Parse(String = ConfNames["LogFileName"], Path = ConfPath)}.log" - with open(LogFile, "a", encoding="utf-8", buffering=1) as File: - File.write(f"{Parse(String = ConfLog["All"], Path = ConfPath)}{Text}\n") + if (GetConf("Logging", ConfPath) == 1): + if (ConfDirs["LogDir"] != None and ConfNames != "Unset"): + if (ConfNames["LogFileName"] != None and ConfNames["LogFileName"] != "Unset"): + Dir(Parse(String = ConfDirs["LogDir"], Path = ConfPath), Output = False, CopyConf = False) + LogFile = f"{Parse(String = ConfDirs["LogDir"], Path = ConfPath)}/{Parse(String = ConfNames["LogFileName"], Path = ConfPath)}.log" + with open(LogFile, "a", encoding="utf-8", buffering=1) as File: + File.write(f"{Parse(String = ConfLog["All"], Path = ConfPath)}{Text}\n") def DecideNewPath(FilePath):