Enable log to file

This commit is contained in:
Matt Nadareski
2016-04-14 14:35:12 -07:00
parent 290de40ac5
commit c7f6f73884
2 changed files with 11 additions and 4 deletions

View File

@@ -33,6 +33,7 @@ namespace SabreTools
private static bool _forceunzip; private static bool _forceunzip;
private static bool _allfiles; private static bool _allfiles;
private static bool _old; private static bool _old;
private static bool _log;
private static string _name; private static string _name;
private static string _desc; private static string _desc;
private static string _cat; private static string _cat;
@@ -51,11 +52,9 @@ namespace SabreTools
{ {
Console.Clear(); Console.Clear();
Console.Title = "DATFromDir " + Build.Version; Console.Title = "DATFromDir " + Build.Version;
_logger = new Logger(false, "datfromdir.log");
_logger.Start();
// First things first, take care of all of the arguments that this could have // First things first, take care of all of the arguments that this could have
_noMD5 = false; _noSHA1 = false; _forceunzip = false; _allfiles = false; _old = false; _noMD5 = false; _noSHA1 = false; _forceunzip = false; _allfiles = false; _old = false; _log = false; ;
_name = ""; _desc = ""; _cat = ""; _version = ""; _author = ""; _basePath = ""; _name = ""; _desc = ""; _cat = ""; _version = ""; _author = ""; _basePath = "";
List<string> inputs = new List<string>(); List<string> inputs = new List<string>();
foreach (string arg in args) foreach (string arg in args)
@@ -92,6 +91,10 @@ namespace SabreTools
case "--old": case "--old":
_old = true; _old = true;
break; break;
case "-l":
case "--log":
_log = true;
break;
default: default:
if (arg.StartsWith("-n=") || arg.StartsWith("--name=")) if (arg.StartsWith("-n=") || arg.StartsWith("--name="))
{ {
@@ -121,6 +124,9 @@ namespace SabreTools
} }
} }
_logger = new Logger(_log, "datfromdir.log");
_logger.Start();
// If there's no inputs, show the help // If there's no inputs, show the help
if (inputs.Count == 0) if (inputs.Count == 0)
{ {

View File

@@ -119,7 +119,8 @@ Options:
-d=, --desc= Set the description of the DAT -d=, --desc= Set the description of the DAT
-c=, --cat= Set the category of the DAT -c=, --cat= Set the category of the DAT
-v=, --version= Set the version of the DAT -v=, --version= Set the version of the DAT
-a=, --author= Set the author of the DAT"); -a=, --author= Set the author of the DAT
-l, --log Enable log to file");
break; break;
default: default:
Console.Write("This is the default help output"); Console.Write("This is the default help output");