AppDomainPatternConverter.cs 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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.Text;
  21. using System.IO;
  22. using log4net.Core;
  23. namespace log4net.Layout.Pattern
  24. {
  25. /// <summary>
  26. /// Write the event appdomain name to the output
  27. /// </summary>
  28. /// <remarks>
  29. /// <para>
  30. /// Writes the <see cref="LoggingEvent.Domain"/> to the output writer.
  31. /// </para>
  32. /// </remarks>
  33. /// <author>Daniel Cazzulino</author>
  34. /// <author>Nicko Cadell</author>
  35. internal sealed class AppDomainPatternConverter : PatternLayoutConverter
  36. {
  37. /// <summary>
  38. /// Write the event appdomain name to the output
  39. /// </summary>
  40. /// <param name="writer"><see cref="TextWriter" /> that will receive the formatted result.</param>
  41. /// <param name="loggingEvent">the event being logged</param>
  42. /// <remarks>
  43. /// <para>
  44. /// Writes the <see cref="LoggingEvent.Domain"/> to the output <paramref name="writer"/>.
  45. /// </para>
  46. /// </remarks>
  47. override protected void Convert(TextWriter writer, LoggingEvent loggingEvent)
  48. {
  49. writer.Write(loggingEvent.Domain);
  50. }
  51. }
  52. }