ExternalLogWriter.cs 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #region --------------- Copyright Dresser Wayne Pignone -------------
  2. /*
  3. * $Log: /Wrk/WayneLibraries/Wrk/Log/ExternalLogWriter.cs $
  4. *
  5. * 3 08-02-26 13:23 Mattias.larsson
  6. * Corrected the method-summaries.
  7. *
  8. * 2 08-02-15 10:17 Mattias.larsson
  9. * Changed the interface to an abstract class.
  10. */
  11. #endregion
  12. using System.Collections.Generic;
  13. namespace Wayne.Lib.Log
  14. {
  15. /// <summary>
  16. /// Interface to an external log writer
  17. /// </summary>
  18. public abstract class ExternalLogWriter
  19. {
  20. #region Properties
  21. /// <summary>
  22. /// Identifies the type of external log writer used in the configuration.
  23. /// </summary>
  24. public abstract string ExternalLogType { get; }
  25. /// <summary>
  26. /// Identifies the external log writer used in the configuration.
  27. /// </summary>
  28. public abstract string ExternalLogName { get; }
  29. /// <summary>
  30. /// Tells whether the log writer is currently active.
  31. /// </summary>
  32. public abstract bool Active { get; }
  33. #endregion
  34. #region Methods
  35. internal void InitParametersInternal(Dictionary<string, string> dictionary)
  36. {
  37. InitParameters(dictionary);
  38. }
  39. internal void LogInternal(LogEntry logEntry, string formattedText)
  40. {
  41. Log(logEntry, formattedText);
  42. }
  43. /// <summary>
  44. /// Get the LogTextWritingParameters.
  45. /// </summary>
  46. /// <returns>Returns the LogTextWritingParameters.</returns>
  47. protected LogTextWritingParameters GetExternalLoggerWritingParameters()
  48. {
  49. return null; // Logger.GetExternalLoggerWritingParameters(this);
  50. }
  51. /// <summary>
  52. /// Called once just before the first log entry.
  53. /// </summary>
  54. /// <param name="dictionary">The Param-nodes from the XML-config file</param>
  55. protected abstract void InitParameters(Dictionary<string, string> dictionary);
  56. /// <summary>
  57. /// Called when a log entry should be handled by this external log writer.
  58. /// </summary>
  59. /// <param name="logEntry">The LogEntry to log.</param>
  60. /// <param name="formattedText">The LogEntry as a formatted string.</param>
  61. protected abstract void Log(LogEntry logEntry, string formattedText);
  62. #endregion
  63. }
  64. }