//----------------------------------------------------------------------- // // Copyright (c) 2010 Deltares. All rights reserved. // // B.S.T. The // tom.the@deltares.nl // 04-11-2010 // n.a. //----------------------------------------------------------------------- namespace Deltares.Dam.Data { using System; using System.Diagnostics; using System.IO; using Deltares.Dam.Data; public class ApplicationLogger { public const string errorLogExtension = "errorlog.txt"; public static StreamWriter AppendErrorLog(string workingPath, Dike dike) { StreamWriter errorLog = null; try { errorLog = File.AppendText(workingPath + dike.Name + errorLogExtension); } catch (Exception e) { Trace.Assert(false, "Could not append to errorlog." + e.ToString()); } return errorLog; } public static StreamWriter CreateErrorLog(string workingPath, Dike dike) { StreamWriter errorLog = null; try { errorLog = File.CreateText(workingPath + dike.Name + errorLogExtension); } catch (Exception e) { Trace.Assert(false, "Could not create errorlog." + e.ToString()); } return errorLog; } } }