IAppenderAttachable.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #region Apache License
  2. //
  3. // Licensed to the Apache Software Foundation (ASF) under one or more
  4. // contributor license agreements. See the NOTICE file distributed with
  5. // this work for additional information regarding copyright ownership.
  6. // The ASF licenses this file to you under the Apache License, Version 2.0
  7. // (the "License"); you may not use this file except in compliance with
  8. // the License. You may obtain a copy of the License at
  9. //
  10. // http://www.apache.org/licenses/LICENSE-2.0
  11. //
  12. // Unless required by applicable law or agreed to in writing, software
  13. // distributed under the License is distributed on an "AS IS" BASIS,
  14. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. // See the License for the specific language governing permissions and
  16. // limitations under the License.
  17. //
  18. #endregion
  19. using System;
  20. using log4net.Appender;
  21. namespace log4net.Core
  22. {
  23. /// <summary>
  24. /// Interface for attaching appenders to objects.
  25. /// </summary>
  26. /// <remarks>
  27. /// <para>
  28. /// Interface for attaching, removing and retrieving appenders.
  29. /// </para>
  30. /// </remarks>
  31. /// <author>Nicko Cadell</author>
  32. /// <author>Gert Driesen</author>
  33. public interface IAppenderAttachable
  34. {
  35. /// <summary>
  36. /// Attaches an appender.
  37. /// </summary>
  38. /// <param name="appender">The appender to add.</param>
  39. /// <remarks>
  40. /// <para>
  41. /// Add the specified appender. The implementation may
  42. /// choose to allow or deny duplicate appenders.
  43. /// </para>
  44. /// </remarks>
  45. void AddAppender(IAppender appender);
  46. /// <summary>
  47. /// Gets all attached appenders.
  48. /// </summary>
  49. /// <value>
  50. /// A collection of attached appenders.
  51. /// </value>
  52. /// <remarks>
  53. /// <para>
  54. /// Gets a collection of attached appenders.
  55. /// If there are no attached appenders the
  56. /// implementation should return an empty
  57. /// collection rather than <c>null</c>.
  58. /// </para>
  59. /// </remarks>
  60. AppenderCollection Appenders {get;}
  61. /// <summary>
  62. /// Gets an attached appender with the specified name.
  63. /// </summary>
  64. /// <param name="name">The name of the appender to get.</param>
  65. /// <returns>
  66. /// The appender with the name specified, or <c>null</c> if no appender with the
  67. /// specified name is found.
  68. /// </returns>
  69. /// <remarks>
  70. /// <para>
  71. /// Returns an attached appender with the <paramref name="name"/> specified.
  72. /// If no appender with the specified name is found <c>null</c> will be
  73. /// returned.
  74. /// </para>
  75. /// </remarks>
  76. IAppender GetAppender(string name);
  77. /// <summary>
  78. /// Removes all attached appenders.
  79. /// </summary>
  80. /// <remarks>
  81. /// <para>
  82. /// Removes and closes all attached appenders
  83. /// </para>
  84. /// </remarks>
  85. void RemoveAllAppenders();
  86. /// <summary>
  87. /// Removes the specified appender from the list of attached appenders.
  88. /// </summary>
  89. /// <param name="appender">The appender to remove.</param>
  90. /// <returns>The appender removed from the list</returns>
  91. /// <remarks>
  92. /// <para>
  93. /// The appender removed is not closed.
  94. /// If you are discarding the appender you must call
  95. /// <see cref="IAppender.Close"/> on the appender removed.
  96. /// </para>
  97. /// </remarks>
  98. IAppender RemoveAppender(IAppender appender);
  99. /// <summary>
  100. /// Removes the appender with the specified name from the list of appenders.
  101. /// </summary>
  102. /// <param name="name">The name of the appender to remove.</param>
  103. /// <returns>The appender removed from the list</returns>
  104. /// <remarks>
  105. /// <para>
  106. /// The appender removed is not closed.
  107. /// If you are discarding the appender you must call
  108. /// <see cref="IAppender.Close"/> on the appender removed.
  109. /// </para>
  110. /// </remarks>
  111. IAppender RemoveAppender(string name);
  112. }
  113. }