1 | /*
|
---|
2 | * Licensed to the Apache Software Foundation (ASF) under one or more
|
---|
3 | * contributor license agreements. See the NOTICE file distributed with
|
---|
4 | * this work for additional information regarding copyright ownership.
|
---|
5 | * The ASF licenses this file to You under the Apache License, Version 2.0
|
---|
6 | * (the "License"); you may not use this file except in compliance with
|
---|
7 | * the License. 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 |
|
---|
18 | #ifndef _LOG4CXX_SIMPLE_LAYOUT_H
|
---|
19 | #define _LOG4CXX_SIMPLE_LAYOUT_H
|
---|
20 |
|
---|
21 | #if defined(_MSC_VER)
|
---|
22 | #pragma warning ( push )
|
---|
23 | #pragma warning ( disable: 4231 4251 4275 4786 )
|
---|
24 | #endif
|
---|
25 |
|
---|
26 |
|
---|
27 | #include <log4cxx/layout.h>
|
---|
28 |
|
---|
29 | namespace log4cxx
|
---|
30 | {
|
---|
31 | /**
|
---|
32 | SimpleLayout consists of the level of the log statement,
|
---|
33 | followed by " - " and then the log message itself. For example,
|
---|
34 |
|
---|
35 | <pre>
|
---|
36 | DEBUG - Hello world
|
---|
37 | </pre>
|
---|
38 |
|
---|
39 | <p>
|
---|
40 |
|
---|
41 | <p>PatternLayout offers a much more powerful alternative.
|
---|
42 | */
|
---|
43 | class LOG4CXX_EXPORT SimpleLayout : public Layout
|
---|
44 | {
|
---|
45 | public:
|
---|
46 | DECLARE_LOG4CXX_OBJECT(SimpleLayout)
|
---|
47 | BEGIN_LOG4CXX_CAST_MAP()
|
---|
48 | LOG4CXX_CAST_ENTRY(SimpleLayout)
|
---|
49 | LOG4CXX_CAST_ENTRY_CHAIN(Layout)
|
---|
50 | END_LOG4CXX_CAST_MAP()
|
---|
51 |
|
---|
52 | /**
|
---|
53 | Returns the log statement in a format consisting of the
|
---|
54 | <code>level</code>, followed by " - " and then the
|
---|
55 | <code>message</code>. For example, <pre> INFO - "A message"
|
---|
56 | </pre>
|
---|
57 |
|
---|
58 | @return A byte array in SimpleLayout format.
|
---|
59 | */
|
---|
60 | virtual void format(LogString& output,
|
---|
61 | const spi::LoggingEventPtr& event,
|
---|
62 | log4cxx::helpers::Pool& pool) const;
|
---|
63 |
|
---|
64 | /**
|
---|
65 | The SimpleLayout does not handle the throwable contained within
|
---|
66 | {@link spi::LoggingEvent LoggingEvents}. Thus, it returns
|
---|
67 | <code>true</code>.
|
---|
68 | */
|
---|
69 | bool ignoresThrowable() const { return true; }
|
---|
70 |
|
---|
71 | virtual void activateOptions(log4cxx::helpers::Pool& /* p */) {}
|
---|
72 | virtual void setOption(const LogString& /* option */,
|
---|
73 | const LogString& /* value */) {}
|
---|
74 | };
|
---|
75 | LOG4CXX_PTR_DEF(SimpleLayout);
|
---|
76 | } // namespace log4cxx
|
---|
77 |
|
---|
78 |
|
---|
79 | #if defined(_MSC_VER)
|
---|
80 | #pragma warning ( pop )
|
---|
81 | #endif
|
---|
82 |
|
---|
83 | #endif //_LOG4CXX_SIMPLE_LAYOUT_H
|
---|