DiagnosticAbstraction.cs 840 B

1234567891011121314151617181920212223242526272829
  1. using System.Diagnostics;
  2. namespace Renci.SshNet.Abstractions
  3. {
  4. internal static class DiagnosticAbstraction
  5. {
  6. private static readonly SourceSwitch SourceSwitch = new SourceSwitch("SshNetSwitch");
  7. public static bool IsEnabled(TraceEventType traceEventType)
  8. {
  9. return SourceSwitch.ShouldTrace(traceEventType);
  10. }
  11. private static readonly TraceSource Loggging =
  12. #if DEBUG
  13. new TraceSource("SshNet.Logging", SourceLevels.All);
  14. #else
  15. new TraceSource("SshNet.Logging");
  16. #endif // DEBUG
  17. [Conditional("DEBUG")]
  18. public static void Log(string text)
  19. {
  20. Loggging.TraceEvent(TraceEventType.Verbose,
  21. System.Environment.CurrentManagedThreadId,
  22. text);
  23. }
  24. }
  25. }