public class CreateErrorLog
{
#region Variables
private string m_sLogFormat;
private string m_sErrorTime;
#endregion
#region Properties
//get and set - public access of private members
public string LogFormat
{
get
{
return m_sLogFormat;
}
set
{
m_sLogFormat = value;
}
}
public string ErrorTime
{
get
{
return m_sErrorTime;
}
set
{
m_sErrorTime = value;
}
}
#endregion
#region Constructor
public CreateErrorLog()
{
// TODO: Add constructor logic here
m_sLogFormat = "[2T]"+ DateTime.Now.ToShortDateString().ToString()+" "+DateTime.Now.ToLongTimeString().ToString()+" ==> ";
string sYear = DateTime.Now.Year.ToString();
string sMonth = DateTime.Now.Month.ToString();
string sDay = DateTime.Now.Day.ToString();
m_sErrorTime = sYear+sMonth+sDay;
}
~CreateErrorLog(){}
#endregion
#region Functions
public void ErrorLog(string sPathName, string sErrMsg)
{
StreamWriter sw = File.AppendText(sPathName+m_sErrorTime+".txt");
sw.WriteLine(m_sLogFormat + sErrMsg);
sw.Flush();
sw.Close();
}
#endregion
}
Wednesday, May 23, 2007
Subscribe to:
Post Comments (Atom)
Blog Archive
-
▼
2007
(13)
-
▼
May
(12)
- MessageBox with more options in C#
- Error Report Example in C#
- Error Report Example in C++
- Ascii to Hex in C#
- Hex to Ascii Conversion in C#
- C# File Open, Save in .Net Framework and Compact F...
- C++ File Open, save in .Net Compact Framework
- How to do a folder browing in .Net Compact Framework?
- Folder Browsing --- Easy way 2
- Folder Browsing --- Easy way 1
- Microsoft way to do folder browsing
- How to do a folder browsing in C#?
-
▼
May
(12)
No comments:
Post a Comment