public CrashPrompt(CrashPromptArgs args) { InitializeComponent(); if (args.HasDetails()) { this.details = args.Details; this.CrashDetailsContent.Text = args.Details; this.btnDetails.Visibility = Visibility.Visible; InstrumentationLogger.LogInfo("CrasphPrompt", args.Details); } else { InstrumentationLogger.LogInfo("CrasphPrompt", "No details"); } if (args.IsFilePath()) { folderPath = Path.GetDirectoryName(args.FilePath); btnOpenFolder.Visibility = Visibility.Visible; } if (args.IsDefaultTextOverridden()) { string overridingText = args.OverridingText; if (args.IsFilePath()) { overridingText = overridingText.Replace("[FILEPATH]", args.FilePath); } ConvertFormattedTextIntoTextblock(this.txtOverridingText, overridingText); } }
/// <summary> /// Log the message to the the correct path /// </summary> /// <param name="message"></param> private void Log(string message, LogLevel level, bool reportModification) { lock (this.guardMutex) { //Don't overwhelm the logging system if (dynSettings.Controller != null && !dynSettings.Controller.DebugSettings.VerboseLogging) { InstrumentationLogger.LogInfo("LogMessage-" + level.ToString(), message); } switch (level) { //write to the console case LogLevel.Console: if (ConsoleWriter != null) { try { ConsoleWriter.AppendLine(string.Format("{0}", message)); FileWriter.WriteLine(string.Format("{0} : {1}", DateTime.Now, message)); FileWriter.Flush(); RaisePropertyChanged("ConsoleWriter"); } catch { // likely caught if the writer is closed } } break; //write to the file case LogLevel.File: if (FileWriter != null) { try { FileWriter.WriteLine(string.Format("{0} : {1}", DateTime.Now, message)); FileWriter.Flush(); } catch { // likely caught if the writer is closed } } break; } if (reportModification) { RaisePropertyChanged("LogText"); } } }
/// <summary> /// Log the message to the the correct path /// </summary> /// <param name="message"></param> private void Log(string message, LogLevel level, bool reportModification) { InstrumentationLogger.LogInfo("LogMessage-" + level.ToString(), message); switch (level) { //write to the console case LogLevel.Console: if (ConsoleWriter != null) { try { ConsoleWriter.AppendLine(string.Format("{0}", message)); FileWriter.WriteLine(string.Format("{0} : {1}", DateTime.Now, message)); FileWriter.Flush(); RaisePropertyChanged("ConsoleWriter"); } catch { // likely caught if the writer is closed } } break; //write to the file case LogLevel.File: if (FileWriter != null) { try { FileWriter.WriteLine(string.Format("{0} : {1}", DateTime.Now, message)); FileWriter.Flush(); } catch { // likely caught if the writer is closed } } break; } if (reportModification) { RaisePropertyChanged("LogText"); } }
/// <summary> /// Log visualization update timing and geometry data. /// </summary> /// <param name="rd">The aggregated render description for the model.</param> /// <param name="ellapsedTime">The ellapsed time of visualization as a string.</param> protected void LogVisualizationUpdateData(RenderDescription rd, string ellapsedTime) { var renderDict = new Dictionary <string, object>(); renderDict["points"] = rd.Points.Count; renderDict["line_segments"] = rd.Lines.Count / 2; renderDict["mesh_facets"] = rd.Meshes.Any() ? rd.Meshes.Select(x => x.TriangleIndices.Count / 3).Aggregate((a, b) => a + b) : 0; renderDict["time"] = ellapsedTime; renderDict["manager_type"] = this.GetType().ToString(); var renderData = JsonConvert.SerializeObject(renderDict); InstrumentationLogger.LogInfo("Perf-Latency-RenderGeometryGeneration", renderData); //Debug.WriteLine(renderData); }