IPlugin.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 log4net.Repository;
  20. namespace log4net.Plugin
  21. {
  22. /// <summary>
  23. /// Interface implemented by logger repository plugins.
  24. /// </summary>
  25. /// <remarks>
  26. /// <para>
  27. /// Plugins define additional behavior that can be associated
  28. /// with a <see cref="log4net.Repository.ILoggerRepository"/>.
  29. /// The <see cref="PluginMap"/> held by the <see cref="log4net.Repository.ILoggerRepository.PluginMap"/>
  30. /// property is used to store the plugins for a repository.
  31. /// </para>
  32. /// <para>
  33. /// The <c>log4net.Config.PluginAttribute</c> can be used to
  34. /// attach plugins to repositories created using configuration
  35. /// attributes.
  36. /// </para>
  37. /// </remarks>
  38. /// <author>Nicko Cadell</author>
  39. /// <author>Gert Driesen</author>
  40. public interface IPlugin
  41. {
  42. /// <summary>
  43. /// Gets the name of the plugin.
  44. /// </summary>
  45. /// <value>
  46. /// The name of the plugin.
  47. /// </value>
  48. /// <remarks>
  49. /// <para>
  50. /// Plugins are stored in the <see cref="PluginMap"/>
  51. /// keyed by name. Each plugin instance attached to a
  52. /// repository must be a unique name.
  53. /// </para>
  54. /// </remarks>
  55. string Name { get; }
  56. /// <summary>
  57. /// Attaches the plugin to the specified <see cref="ILoggerRepository"/>.
  58. /// </summary>
  59. /// <param name="repository">The <see cref="ILoggerRepository"/> that this plugin should be attached to.</param>
  60. /// <remarks>
  61. /// <para>
  62. /// A plugin may only be attached to a single repository.
  63. /// </para>
  64. /// <para>
  65. /// This method is called when the plugin is attached to the repository.
  66. /// </para>
  67. /// </remarks>
  68. void Attach(ILoggerRepository repository);
  69. /// <summary>
  70. /// Is called when the plugin is to shutdown.
  71. /// </summary>
  72. /// <remarks>
  73. /// <para>
  74. /// This method is called to notify the plugin that
  75. /// it should stop operating and should detach from
  76. /// the repository.
  77. /// </para>
  78. /// </remarks>
  79. void Shutdown();
  80. }
  81. }