/ Published in: C#
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
namespace Kyrathasoft.Dialogs.ErrLogging { using System; using System.IO; using System.Windows.Forms; class clsErrLog { public clsErrLog() { //set default path for error log text file errLogPath = Path.GetDirectoryName(Application.ExecutablePath) + "\\errorLog.txt"; } public clsErrLog(string errTxt) { //set default path for error log text file errLogPath = Path.GetDirectoryName(Application.ExecutablePath) + "\\errorLog.txt"; updateErrorLog(errTxt); } public clsErrLog(string errTxt, string full_path) { errLogPath = full_path; updateErrorLog(errTxt); } private string errLogPath; public string ErrLogPath { get { return errLogPath; } set { errLogPath = value; } } private void updateErrorLog(string errorText) { string msg = Environment.NewLine + Environment.NewLine; msg += DateTime.Now.ToString() + Environment.NewLine + errorText; File.AppendAllText(errLogPath, msg); } } }