DevTreks.Exceptions/DevTreksErrors.cs
//public static string GetMessage(string resourceName, CultureInfo culture)
//{
//    //keep for debugging embedded resources
//    string sResourceValue = string.Empty;
//    try
//    {
//        sResourceValue = rm.GetString(resourceName);
//    }
//    catch (Exception x)
//    {
//        string sErr = x.Message;
//    }
//    if (sResourceValue == null)
//    {
//        sResourceValue = string.Empty;
//    }
//    return sResourceValue;
//}
/// <summary>
/// Append a new error message to the log file
/// </summary>
/// <param name="errMessage"></param>
Append a new error message to the log file
Append a new error message to the log file
public static void AppendToErrorLog(string errMessage, int recursions, 
            string defaultErrorRootFullPath)
		{
			string sToday = GetTodaysDate();
			StringBuilder oString = new StringBuilder();
			oString.Append(defaultErrorRootFullPath);
			oString.Append(sToday);
			oString.Append(".txt");
			string sLogFile = oString.ToString();
			oString = null;
			try 
			{
                if (Path.IsPathRooted(defaultErrorRootFullPath))
                {
                    string sDirectoryName = Path.GetDirectoryName(defaultErrorRootFullPath);
                    if (Directory.Exists(sDirectoryName) == false)
                    {
                        Directory.CreateDirectory(defaultErrorRootFullPath);
                    }
                }
                FileStream oFileStream = null;
                if (File.Exists(sLogFile))
                {
                    oFileStream = new FileStream(sLogFile, FileMode.Append, 
                        FileAccess.Write, FileShare.Write);
                }
                else
                {
                    oFileStream = new FileStream(sLogFile, FileMode.CreateNew, 
                        FileAccess.Write, FileShare.Write);
                }
                if (oFileStream != null)
                {
                    using (oFileStream)
                    {
                        StreamWriter oLogWriter = new StreamWriter(oFileStream);
                        if (oLogWriter != null)
                        {
                            using (oLogWriter)
                            {
                                LogError(errMessage, oLogWriter);
                            }
                        }
                    }
                }
			}
			catch 
			{
				if (recursions == 1) 
				{
				}
			}
		}
public static void AppendToErrorLog ( string errMessage , int recursions , string defaultErrorRootFullPath ) { string sToday = GetTodaysDate ( ) ; StringBuilder oString = new StringBuilder ( ) ; oString . Append ( defaultErrorRootFullPath ) ; oString . Append ( sToday ) ; oString . Append ( " " ) ; string sLogFile = oString . ToString ( ) ; oString = null ; try { if ( Path . IsPathRooted ( defaultErrorRootFullPath ) ) { string sDirectoryName = Path . GetDirectoryName ( defaultErrorRootFullPath ) ; if ( Directory . Exists ( sDirectoryName ) == false ) { Directory . CreateDirectory ( defaultErrorRootFullPath ) ; } } FileStream oFileStream = null ; if ( File . Exists ( sLogFile ) ) { oFileStream = new FileStream ( sLogFile , FileMode . Append , FileAccess . Write , FileShare . Write ) ; } else { oFileStream = new FileStream ( sLogFile , FileMode . CreateNew , FileAccess . Write , FileShare . Write ) ; } if ( oFileStream != null ) { using ( oFileStream ) { StreamWriter oLogWriter = new StreamWriter ( oFileStream ) ; if ( oLogWriter != null ) { using ( oLogWriter ) { LogError ( errMessage , oLogWriter ) ; } } } } } catch { if ( recursions == 1 ) { } } }
Append a new error message to the log file
Append a new error message to the log file
//relative path to standard write directory //azure has blobdirectory in name //don't use asynchronous unless log file shows this class is generating errors //162 removed: no reason to recurse  //AppendToErrorLog(errMessage, 1, defaultErrorRootFullPath);
errMessage
string
None
recursions
int
defaultErrorRootFullPath
string