summaryrefslogtreecommitdiff
path: root/src/3rd_party/apache-log4cxx-0.10.0/src/main/include/log4cxx/htmllayout.h
blob: 8c0c6a7f32486cbb22321c6b9e4626f7f4567b05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _LOG4CXX_HTML_LAYOUT_H
#define _LOG4CXX_HTML_LAYOUT_H

#if defined(_MSC_VER)
#pragma warning ( push )
#pragma warning ( disable: 4231 4251 4275 4786 )
#endif


#include <log4cxx/layout.h>
#include <log4cxx/helpers/iso8601dateformat.h>



namespace log4cxx
{
        /**
        This layout outputs events in a HTML table.
        */
        class LOG4CXX_EXPORT HTMLLayout : public Layout
        {
        private:
                // Print no location info by default
                bool locationInfo; //= false

                LogString title;

                helpers::ISO8601DateFormat dateFormat;

        public:
                DECLARE_LOG4CXX_OBJECT(HTMLLayout)
                BEGIN_LOG4CXX_CAST_MAP()
                        LOG4CXX_CAST_ENTRY(HTMLLayout)
                        LOG4CXX_CAST_ENTRY_CHAIN(Layout)
                END_LOG4CXX_CAST_MAP()

                HTMLLayout();

                /**
                The <b>LocationInfo</b> option takes a boolean value. By
                default, it is set to false which means there will be no location
                information output by this layout. If the the option is set to
                true, then the file name and line number of the statement
                at the origin of the log statement will be output.

                <p>If you are embedding this layout within an
                {@link net::SMTPAppender SMTPAppender} then make sure
                to set the <b>LocationInfo</b> option of that appender as well.
                */
                inline void setLocationInfo(bool locationInfoFlag)
                        { this->locationInfo = locationInfoFlag; }

                /**
                Returns the current value of the <b>LocationInfo</b> option.
                */
                inline bool getLocationInfo() const
                        { return locationInfo; }

                /**
                The <b>Title</b> option takes a String value. This option sets the
                document title of the generated HTML document.
                <p>Defaults to 'Log4cxx Log Messages'.
                */
                inline void setTitle(const LogString& title1)
                        { this->title.assign(title1); }

                /**
                Returns the current value of the <b>Title</b> option.
                */
                inline const LogString& getTitle() const
                        { return title; }

                /**
                Returns the content type output by this layout, i.e "text/html".
                */
                virtual LogString getContentType() const { return LOG4CXX_STR("text/html"); }

                /**
                No options to activate.
                */
                virtual void activateOptions(log4cxx::helpers::Pool& /* p */) {}

                /**
                Set options
                */
                virtual void setOption(const LogString& option, const LogString& value);

                virtual void format(LogString& output,
                     const spi::LoggingEventPtr& event, log4cxx::helpers::Pool& pool) const;

                /**
                Append appropriate HTML headers.
                */
                virtual void appendHeader(LogString& output, log4cxx::helpers::Pool& pool);

                /**
                Append the appropriate HTML footers.
                */
                virtual void appendFooter(LogString& output, log4cxx::helpers::Pool& pool);

                /**
                The HTML layout handles the throwable contained in logging
                events. Hence, this method return <code>false</code>.  */
                virtual bool ignoresThrowable() const
                        { return false; }

        }; // class HtmlLayout
      LOG4CXX_PTR_DEF(HTMLLayout);
}  // namespace log4cxx

#if defined(_MSC_VER)
#pragma warning ( pop )
#endif


#endif // _LOG4CXX_HTML_LAYOUT_H