Skip to content

Commit

Permalink
Added simple error logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
cubski committed Aug 18, 2015
1 parent f756806 commit d27c8bf
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions QuickbooksExporter/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,25 @@ class Program
{
static void Main()
{
var settings = GetExportSettings();
try
{
var settings = GetExportSettings();

Console.WriteLine("Retrieving Item Inventories from Quickbooks...");
Console.WriteLine("Retrieving Item Inventories from Quickbooks...");

var itemInventories = GetItemInventories(settings);
var itemInventories = GetItemInventories(settings);

Console.WriteLine($"Found {itemInventories.Rows.Count} Item Inventories.");
Console.WriteLine($"Found {itemInventories.Rows.Count} Item Inventories.");

Console.WriteLine("Dumping to CSV...");
Console.WriteLine("Dumping to CSV...");

DumpToCsv(settings, itemInventories);
DumpToCsv(settings, itemInventories);
}
catch (Exception ex)
{
LogError(ex);
Console.WriteLine(ex.Message);
}

Console.WriteLine("Press any key to exit...");

Expand Down Expand Up @@ -73,5 +81,10 @@ static ExportSettings GetExportSettings()
OutputFileName = ConfigurationManager.AppSettings["OutputFileName"]
};
}

static void LogError(Exception ex)
{
File.AppendAllText("error.log", $"[{DateTime.Now}]: {ex}" + Environment.NewLine);
}
}
}

0 comments on commit d27c8bf

Please sign in to comment.