private static void ConfigureTrace(ITrace trace, ISettings settings, StandardStreams streams) { if (settings.GetTracingEnabled(out string traceValue)) { if (traceValue.IsTruthy()) // Trace to stderr { trace.AddListener(streams.Error); } else if (Path.IsPathRooted(traceValue)) // Trace to a file { try { Stream stream = File.Open(traceValue, FileMode.Append, FileAccess.Write, FileShare.ReadWrite); TextWriter _traceFileWriter = new StreamWriter(stream, new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), 4096, leaveOpen: false); trace.AddListener(_traceFileWriter); } catch (Exception ex) { streams.Error.WriteLine($"warning: unable to trace to file '{traceValue}': {ex.Message}"); } } else { streams.Error.WriteLine($"warning: unknown value for trace '{traceValue}'"); } } }
public void OnSelected(IGame selectedGame) { Mouse.OverrideCursor = Cursors.Arrow; #if DEBUG InfoToFile log = new InfoToFile(@".\Logs\ManageImages.log", true); ITrace.AddListener(log); try { // ITrace.Clear(); } catch (Exception exc2) { ITrace.WriteLine(exc2.ToString()); } #endif try { Manage_W mw = new Manage_W(); mw.GameSelected = selectedGame; mw.ShowDialog(); } catch (Exception exc) { ITrace.WriteLine(exc.ToString()); } }
public Main() { _App = AppDomain.CurrentDomain.BaseDirectory; DxTrace.InfoToFile logFile = new InfoToFile(@".\Logs\Clean_Images.log", false); ITrace.AddListener(logFile); ITrace.WriteLine($"\n {new string('=', 10)} Initialization {new string('=', 10)}"); }
static BasePlugin() { DefaultStyleKeyProperty.OverrideMetadata(typeof(BasePlugin), new FrameworkPropertyMetadata(typeof(BasePlugin))); //_App = AppDomain.CurrentDomain.BaseDirectory; #if DEBUG InfoToFile logFile = new InfoToFile(@".\Logs\Clean_Images.log", true); ITrace.AddListener(logFile); ITrace.WriteLine($"\n {new string('=', 10)} Initialization DebugMode{new string('=', 10)}"); #endif }