IObjectRenderer.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 System.IO;
  21. namespace log4net.ObjectRenderer
  22. {
  23. /// <summary>
  24. /// Implement this interface in order to render objects as strings
  25. /// </summary>
  26. /// <remarks>
  27. /// <para>
  28. /// Certain types require special case conversion to
  29. /// string form. This conversion is done by an object renderer.
  30. /// Object renderers implement the <see cref="IObjectRenderer"/>
  31. /// interface.
  32. /// </para>
  33. /// </remarks>
  34. /// <author>Nicko Cadell</author>
  35. /// <author>Gert Driesen</author>
  36. public interface IObjectRenderer
  37. {
  38. /// <summary>
  39. /// Render the object <paramref name="obj"/> to a string
  40. /// </summary>
  41. /// <param name="rendererMap">The map used to lookup renderers</param>
  42. /// <param name="obj">The object to render</param>
  43. /// <param name="writer">The writer to render to</param>
  44. /// <remarks>
  45. /// <para>
  46. /// Render the object <paramref name="obj"/> to a
  47. /// string.
  48. /// </para>
  49. /// <para>
  50. /// The <paramref name="rendererMap"/> parameter is
  51. /// provided to lookup and render other objects. This is
  52. /// very useful where <paramref name="obj"/> contains
  53. /// nested objects of unknown type. The <see cref="M:RendererMap.FindAndRender(object, TextWriter)"/>
  54. /// method can be used to render these objects.
  55. /// </para>
  56. /// </remarks>
  57. void RenderObject(RendererMap rendererMap, object obj, TextWriter writer);
  58. }
  59. }