PageRenderTime 48ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/src/NUnit/core/LogCapture.cs

#
C# | 48 lines | 32 code | 6 blank | 10 comment | 6 complexity | 1b66ce80814ceb4b3288c26904eb5b57 MD5 | raw file
Possible License(s): GPL-2.0
  1. // ****************************************************************
  2. // Copyright 2008, Charlie Poole
  3. // This is free software licensed under the NUnit license. You may
  4. // obtain a copy of the license at http://nunit.org.
  5. // ****************************************************************
  6. using System.Collections.Specialized;
  7. using System.Configuration;
  8. namespace NUnit.Core
  9. {
  10. public abstract class LogCapture : TextCapture
  11. {
  12. private string defaultThreshold;
  13. /// <summary>
  14. /// The default threshold for log capture
  15. /// is read from the config file. If not
  16. /// found, we use "Error".
  17. /// </summary>
  18. public override string DefaultThreshold
  19. {
  20. get
  21. {
  22. if (defaultThreshold == null)
  23. {
  24. defaultThreshold = "Error";
  25. NameValueCollection settings = (NameValueCollection)
  26. #if NET_2_0
  27. ConfigurationManager.GetSection("NUnit/TestRunner");
  28. #else
  29. ConfigurationSettings.GetConfig("NUnit/TestRunner");
  30. #endif
  31. if (settings != null)
  32. {
  33. string level = settings["DefaultLogThreshold"];
  34. if (level != null)
  35. defaultThreshold = level;
  36. }
  37. }
  38. return defaultThreshold;
  39. }
  40. }
  41. }
  42. }