Logging overhaul!

This change brings about a few changes:
1) A new LogLevel called "User" that is used for non-verbose, non-error output
2) Only User and Error are output to console now, not all of them
3) All programs have log to file enabled by default and all flags for enabling logging have been removed
4) Some former Verbose statements have been converted over to User because of the shift in usage.
This commit is contained in:
Matt Nadareski
2016-05-10 15:41:33 -07:00
parent 37253b8c91
commit 1800ac6750
12 changed files with 80 additions and 85 deletions

View File

@@ -97,11 +97,11 @@ namespace SabreTools
return;
}
Logger logger = new Logger(false, "datfromdir.log");
Logger logger = new Logger(true, "datfromdir.log");
logger.Start();
// First things first, take care of all of the arguments that this could have
bool noMD5 = false, noSHA1 = false, forceunpack = false, archivesAsFiles = false, old = false, log = false, superDat = false, bare = false;
bool noMD5 = false, noSHA1 = false, forceunpack = false, archivesAsFiles = false, old = false, superDat = false, bare = false;
string name = "", desc = "", cat = "", version = "", author = "";
List<string> inputs = new List<string>();
foreach (string arg in args)
@@ -138,10 +138,6 @@ namespace SabreTools
case "--old":
old = true;
break;
case "-l":
case "--log":
log = true;
break;
case "-sd":
case "--superdat":
superDat = true;
@@ -183,9 +179,6 @@ namespace SabreTools
return;
}
// Set the new state for Logger
logger.ToFile = log;
// Output the title
Build.Start("DATFromDir");
@@ -365,7 +358,7 @@ namespace SabreTools
_logger.Log(Path.GetFileName(item) + " treated like an archive");
foreach (string entry in Directory.EnumerateFiles(_tempDir, "*", SearchOption.AllDirectories))
{
_logger.Log("\tFound file: " + entry);
_logger.Log("Found file: " + entry);
string fileCRC = String.Empty;
string fileMD5 = String.Empty;
string fileSHA1 = String.Empty;
@@ -410,7 +403,7 @@ namespace SabreTools
SHA1 = fileSHA1,
});
_logger.Log("File added" + Environment.NewLine);
_logger.User("File added: " + entry + Environment.NewLine);
}
}
// Otherwise, just get the info on the file itself
@@ -474,7 +467,7 @@ namespace SabreTools
SHA1 = fileSHA1,
});
_logger.Log("File added" + Environment.NewLine);
_logger.User("File added: " + actualitem + Environment.NewLine);
}
catch (IOException ex)
{