~ifolder-dev/simias/trunk-packaging

« back to all changes in this revision

Viewing changes to src/core/Simias.log4net/src/Layout/.svn/text-base/SimpleLayout.cs.svn-base

  • Committer: Jorge O. Castro
  • Date: 2007-12-03 06:56:46 UTC
  • Revision ID: jorge@ubuntu.com-20071203065646-mupcnjcwgm5mnhyt
* Remove a bunch of .svn directories we no longer need.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#region Copyright & License
2
 
//
3
 
// Copyright 2001-2005 The Apache Software Foundation
4
 
//
5
 
// Licensed under the Apache License, Version 2.0 (the "License");
6
 
// you may not use this file except in compliance with the License.
7
 
// You may obtain a copy of the License at
8
 
//
9
 
// http://www.apache.org/licenses/LICENSE-2.0
10
 
//
11
 
// Unless required by applicable law or agreed to in writing, software
12
 
// distributed under the License is distributed on an "AS IS" BASIS,
13
 
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 
// See the License for the specific language governing permissions and
15
 
// limitations under the License.
16
 
//
17
 
#endregion
18
 
 
19
 
using System;
20
 
using System.IO;
21
 
using System.Text;
22
 
 
23
 
using log4net.Util;
24
 
using log4net.Core;
25
 
 
26
 
namespace log4net.Layout
27
 
{
28
 
        /// <summary>
29
 
        /// A very simple layout
30
 
        /// </summary>
31
 
        /// <remarks>
32
 
        /// <para>
33
 
        /// SimpleLayout consists of the level of the log statement,
34
 
        /// followed by " - " and then the log message itself. For example,
35
 
        /// <code>
36
 
        /// DEBUG - Hello world
37
 
        /// </code>
38
 
        /// </para>
39
 
        /// </remarks>
40
 
        /// <author>Nicko Cadell</author>
41
 
        /// <author>Gert Driesen</author>
42
 
        public class SimpleLayout : LayoutSkeleton
43
 
        {
44
 
                #region Constructors
45
 
 
46
 
                /// <summary>
47
 
                /// Constructs a SimpleLayout
48
 
                /// </summary>
49
 
                public SimpleLayout()
50
 
                {
51
 
                        IgnoresException = true;
52
 
                }
53
 
 
54
 
                #endregion
55
 
  
56
 
                #region Implementation of IOptionHandler
57
 
 
58
 
                /// <summary>
59
 
                /// Initialize layout options
60
 
                /// </summary>
61
 
                /// <remarks>
62
 
                /// <para>
63
 
                /// This is part of the <see cref="IOptionHandler"/> delayed object
64
 
                /// activation scheme. The <see cref="ActivateOptions"/> method must 
65
 
                /// be called on this object after the configuration properties have
66
 
                /// been set. Until <see cref="ActivateOptions"/> is called this
67
 
                /// object is in an undefined state and must not be used. 
68
 
                /// </para>
69
 
                /// <para>
70
 
                /// If any of the configuration properties are modified then 
71
 
                /// <see cref="ActivateOptions"/> must be called again.
72
 
                /// </para>
73
 
                /// </remarks>
74
 
                override public void ActivateOptions() 
75
 
                {
76
 
                        // nothing to do.
77
 
                }
78
 
 
79
 
                #endregion
80
 
 
81
 
                #region Override implementation of LayoutSkeleton
82
 
 
83
 
                /// <summary>
84
 
                /// Produces a simple formatted output.
85
 
                /// </summary>
86
 
                /// <param name="loggingEvent">the event being logged</param>
87
 
                /// <param name="writer">The TextWriter to write the formatted event to</param>
88
 
                /// <remarks>
89
 
                /// <para>
90
 
                /// Formats the event as the level of the even,
91
 
                /// followed by " - " and then the log message itself. The
92
 
                /// output is terminated by a newline.
93
 
                /// </para>
94
 
                /// </remarks>
95
 
                override public void Format(TextWriter writer, LoggingEvent loggingEvent) 
96
 
                {
97
 
                        if (loggingEvent == null)
98
 
                        {
99
 
                                throw new ArgumentNullException("loggingEvent");
100
 
                        }
101
 
 
102
 
                        writer.Write(loggingEvent.Level.DisplayName);
103
 
                        writer.Write(" - ");
104
 
                        loggingEvent.WriteRenderedMessage(writer);
105
 
                        writer.WriteLine();
106
 
                }
107
 
 
108
 
                #endregion
109
 
        }
110
 
}