Class responsible to log filename, calling function and the line number
 public static void WriteCritical(SourceInfo logSourceInfo, TextBox textbox, BackgroundExecutorWithStatus bgws, string msg, params object[] args)
 {
     LogInternal(logSourceInfo, TraceEventType.Critical, msg, args);
     UpdateUiTextbox(bgws, textbox, msg, args);
 }
 public static void WriteCritical(SourceInfo logSourceInfo, string msg, params object[] args)
 {
     LogInternal(logSourceInfo, TraceEventType.Critical, msg, args);
 }
 private static void LogInternal(SourceInfo logSourceInfo, TraceEventType traceType, string msg, params object[] args)
 {
     if (!TraceSource.Switch.ShouldTrace(traceType)) return;
     if (args.Length != 0)
     {
         msg = string.Format(msg, args);
     }
     string methodName = logSourceInfo.MethodName;
     int lineNumber = logSourceInfo.LineNumber;
     string fileName = logSourceInfo.FileName;
     string background = Thread.CurrentThread.IsBackground ? "Background Thread" : "UI Thread";
     string thread = $"(T{Thread.CurrentThread.ManagedThreadId:x4})";
     string logInfo = string.Format(CultureInfo.InstalledUICulture, "{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}\t{7}",
         DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"),
         background,
         thread,
         fileName,
         methodName,
         lineNumber,
         traceType,
         msg);
     Trace.WriteLine(logInfo);
 }
 public static void WriteCritical(SourceInfo logSourceInfo, TextBox textbox, string msg, params object[] args)
 {
     LogInternal(logSourceInfo, TraceEventType.Critical, msg, args);
     UpdateUiTextbox(textbox, msg, args);
 }
Beispiel #5
0
 public static void WriteInformation(SourceInfo logSourceInfo, string msg, params object[] args)
 {
     LogInternal(logSourceInfo, TraceEventType.Information, msg, args);
 }
Beispiel #6
0
 public static void WriteWarning(SourceInfo logSourceInfo, string msg, params object[] args)
 {
     LogInternal(logSourceInfo, TraceEventType.Warning, msg, args);
 }
Beispiel #7
0
 public static void WriteVerbose(SourceInfo logSourceInfo, string msg, params object[] args)
 {
     LogInternal(logSourceInfo, TraceEventType.Verbose, msg, args);
 }
Beispiel #8
0
 public static void WriteInformation(SourceInfo logSourceInfo, TextBox textbox, BackgroundExecutorWithStatus bgws, string msg, params object[] args)
 {
     LogInternal(logSourceInfo, TraceEventType.Information, msg, args);
     UpdateUiTextbox(bgws, textbox, msg, args);
 }
Beispiel #9
0
 public static void WriteInformation(SourceInfo logSourceInfo, TextBox textbox, string msg, params object[] args)
 {
     LogInternal(logSourceInfo, TraceEventType.Information, msg, args);
     UpdateUiTextbox(textbox, msg, args);
 }