static public void WriteLine(CeTraceLevel ahtl, Type atype, String asMethod, Exception aexception, String asMessage)
 {
     // I18N OK <ccla>
     WriteLineBare(ahtl, "Exception in " + Format(atype, asMethod) +
                   ": " + aexception.GetType().Name + ": " + aexception.Message +
                   (asMessage == null ? String.Empty : ": \"" + asMessage + "\""));
 }
 static public void WriteCallerHeader(CeTraceLevel ahmtracelevel, int aiLevel)
 {
     WriteDividerLine(ahmtracelevel);
     WriteTimeStampLine(ahmtracelevel);
     WriteCaller(ahmtracelevel, aiLevel - 1);
     WriteDividerLine(ahmtracelevel);
 }
        /// <summary>
        /// Write stack data about the caller to trace listeners. Use passed
        /// level to control what is considered the caller. Use 0 for the method
        /// that immediately called this one, subtracting 1 for each method higher
        /// up the call stack.
        /// </summary>
        static public void WriteCaller(CeTraceLevel ahmtracelevel, int aiLevel)
        {
            StackLevel asl = StackLevel.FromEnvironment(5 - aiLevel);

            WriteLineBare(ahmtracelevel, asl.CallingMethod);
            WriteBare(ahmtracelevel, asl.SourcePath);
            WriteBare(ahmtracelevel, " ");
            WriteLineBare(ahmtracelevel, asl.LineNumber);
        }
        static public void WriteLoadedModules(CeTraceLevel ahtl)
        {
            StringWriter asw = new StringWriter(CultureInfo.InvariantCulture);

            ResourceProcessLibrary.ListLoadedModules(asw);

            WriteDividerLine(ahtl);
            WriteBare(ahtl, asw.ToString());
            WriteDividerLine(ahtl);
        }
 static public void WriteLine(CeTraceLevel ahtl, Type atype, String asMethod, String asMessage)
 {
     // return early to avoid unnecessary string operations
     if (!ShouldTrace(ahtl))
     {
         return;
     }
     WriteLineBare(
         ahtl,
         Format(atype, asMethod) + (asMessage == null ? "" : ": " + asMessage));
 }
        static public void WriteTimeStampLine(CeTraceLevel ahmtracelevel, String astring)
        {
#if TIMESTAMP_ALL_LINES
            String astringLine = ResourceStringLibrary.IsBlank(astring) ? String.Empty : astring;
#else
            String astringLine = FormatDateTimeNow();
            if (!StringLibrary.IsBlank(astring))
            {
                astringLine = astringLine + " " + astring;
            }
#endif
            WriteLineBare(ahmtracelevel, astringLine);
        }
        static private void WriteLineBare(CeTraceLevel alevel, String astring)
        {
            // return early to avoid unnecessary string operations
            if (!ShouldTrace(alevel))
            {
                return;
            }
#if TIMESTAMP_ALL_LINES
            String astringLine = astring;             // I18N OK <ccla>
#else
            String astringLine = astring;
#endif
            Trace.WriteLine(astringLine);
        }
 static public void WriteLine(CeTraceLevel ahtl, Object aobject, String asMethod, DataRow adr)
 {
     // return early to avoid unnecessary string operations
     if (!ShouldTrace(ahtl))
     {
         return;
     }
     // I18N OK <ccla>
     WriteLine(ahtl, aobject, asMethod, adr.ToString());
     WriteBare(ahtl, "\t");
     WriteBare(ahtl, "HasErrors: " + adr.HasErrors);
     WriteBare(ahtl, " HasVersion(Current): " + adr.HasVersion(DataRowVersion.Current));
     WriteBare(ahtl, " HasVersion(Default): " + adr.HasVersion(DataRowVersion.Default));
     WriteBare(ahtl, " HasVersion(Original): " + adr.HasVersion(DataRowVersion.Original));
     WriteBare(ahtl, " HasVersion(Proposed): " + adr.HasVersion(DataRowVersion.Proposed));
     WriteBare(ahtl, " RowError: \"" + adr.RowError + "\"");
     WriteBare(ahtl, " RowState: " + adr.RowState);
     WriteLineBare(ahtl, "");
 }
 static public void WriteLine(CeTraceLevel ahtl, Object aobject, String asMethod, OleDbException aode)
 {
     // return early to avoid unnecessary string operations
     if (!ShouldTrace(ahtl))
     {
         return;
     }
     WriteLine(ahtl, aobject, asMethod, (Exception)aode);                // Cast is critical to avoid recursion and stack overflow!
     foreach (OleDbError aerror in aode.Errors)
     {
         // I18N OK <ccla>
         WriteBare(ahtl, "\t");
         WriteBare(ahtl, "Message: " + aerror.Message);
         WriteBare(ahtl, " Native: " + aerror.NativeError);
         WriteBare(ahtl, " Source: " + aerror.Source);
         WriteBare(ahtl, " SQL: " + aerror.SQLState);
         WriteLineBare(ahtl, "");
     }
 }
 static public void WriteLine(CeTraceLevel ahtl, Object aobject, String asMethod, Exception aexception)
 {
     WriteLine(ahtl, aobject, asMethod, aexception, null);
 }
 static public void WriteLine(CeTraceLevel ahtl, Object aobject, String asMethod, String asMessage)
 {
     WriteLine(ahtl, aobject.GetType(), asMethod, asMessage);
 }
 static public void WriteLine(CeTraceLevel ahtl, Object aobject, String asMethod)
 {
     WriteLine(ahtl, aobject, asMethod, (String)null);
 }
 static public void WriteEmptyLine(CeTraceLevel ahmtracelevel)
 {
     WriteLineBare(ahmtracelevel, String.Empty);
 }
 static public void WriteDividerLine(CeTraceLevel ahmtracelevel)
 {
     WriteLineBare(ahmtracelevel, new String('=', 80));
 }
 static public void WriteTimeStampLine(CeTraceLevel ahmtracelevel)
 {
     WriteTimeStampLine(ahmtracelevel, null);
 }
 /// <summary>
 /// WARNING: Use this method very sparingly, because it does not require
 /// logging the originating class/method, which will make understanding
 /// the trace much more difficult.
 /// </summary>
 static public void WriteLine(CeTraceLevel ahtl, String astring)
 {
     WriteLineBare(ahtl, astring);
 }
 static public void WriteLine(CeTraceLevel ahtl, Type atype, String asMethod, Exception aexception)
 {
     WriteLine(ahtl, atype, asMethod, aexception, null);
 }
 static private void WriteBare(CeTraceLevel alevel, String astring)
 {
     Trace.WriteIf(ShouldTrace(alevel), astring);
 }
 static private bool ShouldTrace(CeTraceLevel alevel)
 {
     return(alevel != CeTraceLevel.Off && alevel <= CurrentTraceLevel);
 }