Carrotware.CMS.DBUpdater.DatabaseUpdate.WriteDebugException C# (CSharp) Méthode

WriteDebugException() public static méthode

public static WriteDebugException ( bool bWriteError, string sSrc, Exception objErr ) : void
bWriteError bool
sSrc string
objErr System.Exception
Résultat void
        public static void WriteDebugException(bool bWriteError, string sSrc, Exception objErr)
        {
            #if DEBUG
            bWriteError = true; // always write errors when debug build
            #endif

            if (bWriteError && objErr != null) {
                StringBuilder sb = new StringBuilder();

                sb.AppendLine("----------------  " + sSrc.ToUpperInvariant() + " - " + DateTime.Now.ToString() + "  ----------------");

                sb.AppendLine("[" + objErr.GetType().ToString() + "] " + objErr.Message);

                if (objErr.StackTrace != null) {
                    sb.AppendLine(objErr.StackTrace);
                }

                if (objErr.InnerException != null) {
                    sb.AppendLine(objErr.InnerException.Message);
                }

                string filePath = HttpContext.Current.Server.MapPath("~/carrot_errors.txt");

                Encoding encode = Encoding.Default;
                lock (logLocker) {
                    using (FileStream fs = new FileStream(filePath, FileMode.Append, FileAccess.Write, FileShare.ReadWrite)) {
                        using (StreamWriter oWriter = new StreamWriter(fs, encode)) {
                            oWriter.Write(sb.ToString());
                        }
                    }
                }
            }
        }

Same methods

DatabaseUpdate::WriteDebugException ( string sSrc, Exception objErr ) : void