/src/logging-log4cxx/src/main/include/log4cxx/htmllayout.h
Line | Count | Source |
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_HTML_LAYOUT_H |
19 | | #define _LOG4CXX_HTML_LAYOUT_H |
20 | | |
21 | | #include <log4cxx/layout.h> |
22 | | #include <log4cxx/helpers/iso8601dateformat.h> |
23 | | |
24 | | |
25 | | |
26 | | namespace LOG4CXX_NS |
27 | | { |
28 | | /** |
29 | | This layout outputs events in a HTML table. |
30 | | */ |
31 | | class LOG4CXX_EXPORT HTMLLayout : public Layout |
32 | | { |
33 | | private: |
34 | | LOG4CXX_DECLARE_PRIVATE_MEMBER_PTR(HTMLLayoutPrivate, m_priv) |
35 | | |
36 | | public: |
37 | | DECLARE_LOG4CXX_OBJECT(HTMLLayout) |
38 | 0 | BEGIN_LOG4CXX_CAST_MAP() |
39 | 0 | LOG4CXX_CAST_ENTRY(HTMLLayout) |
40 | 0 | LOG4CXX_CAST_ENTRY_CHAIN(Layout) |
41 | 0 | END_LOG4CXX_CAST_MAP() |
42 | | |
43 | | HTMLLayout(); |
44 | | ~HTMLLayout(); |
45 | | |
46 | | /** |
47 | | The <b>LocationInfo</b> option takes a boolean value. By |
48 | | default, it is set to false which means there will be no location |
49 | | information output by this layout. If the the option is set to |
50 | | true, then the file name and line number of the statement |
51 | | at the origin of the log statement will be output. |
52 | | |
53 | | <p>If you are embedding this layout within an |
54 | | {@link net::SMTPAppender SMTPAppender} then make sure |
55 | | to set the <b>LocationInfo</b> option of that appender as well. |
56 | | */ |
57 | | void setLocationInfo(bool locationInfoFlag); |
58 | | |
59 | | /** |
60 | | Returns the current value of the <b>LocationInfo</b> option. |
61 | | */ |
62 | | bool getLocationInfo() const; |
63 | | |
64 | | /** |
65 | | The <b>Title</b> option takes a String value. This option sets the |
66 | | document title of the generated HTML document. |
67 | | <p>Defaults to 'Log4cxx Log Messages'. |
68 | | */ |
69 | | void setTitle(const LogString& title1); |
70 | | |
71 | | /** |
72 | | Returns the current value of the <b>Title</b> option. |
73 | | */ |
74 | | const LogString& getTitle() const; |
75 | | |
76 | | /** |
77 | | Returns the content type output by this layout, i.e "text/html". |
78 | | */ |
79 | | LogString getContentType() const override; |
80 | | |
81 | | using Layout::activateOptions; |
82 | | #if LOG4CXX_ABI_VERSION <= 15 |
83 | | /** |
84 | | \copybrief spi::OptionHandler::activateOptions() |
85 | | |
86 | | No action is performed in this implementation. |
87 | | */ |
88 | 0 | void activateOptions( LOG4CXX_ACTIVATE_OPTIONS_FORMAL_PARAMETERS ) override {} |
89 | | #endif |
90 | | /** |
91 | | \copybrief spi::OptionHandler::setOption() |
92 | | |
93 | | Supported options | Supported values | Default value | |
94 | | -------------- | ---------------- | --------------- | |
95 | | Title | {any} | Log4cxx Log Messages | |
96 | | LocationInfo | True,False | False | |
97 | | */ |
98 | | void setOption(const LogString& option, const LogString& value) override; |
99 | | |
100 | | using Layout::format; |
101 | | /** |
102 | | Append the attributes of \c event as a HTML table row onto \c output. |
103 | | */ |
104 | | void format( LOG4CXX_FORMAT_LAYOUT_FORMAL_PARAMETERS ) const override; |
105 | | |
106 | | using Layout::appendHeader; |
107 | | /** |
108 | | Append a HTML document header and start a HTML table with column headings |
109 | | that align with the output produced by HTMLLayout::format. |
110 | | */ |
111 | | void appendHeader( LOG4CXX_APPEND_HEADER_FORMAL_PARAMETERS ) override; |
112 | | |
113 | | using Layout::appendFooter; |
114 | | /** |
115 | | Terminate the HTML table and the HTML document. |
116 | | */ |
117 | | void appendFooter( LOG4CXX_APPEND_FOOTER_FORMAL_PARAMETERS ) override; |
118 | | |
119 | | /** |
120 | | The HTML layout handles the throwable contained in logging |
121 | | events. Hence, this method return <code>false</code>. */ |
122 | | bool ignoresThrowable() const override; |
123 | | |
124 | | }; // class HtmlLayout |
125 | | LOG4CXX_PTR_DEF(HTMLLayout); |
126 | | } // namespace log4cxx |
127 | | |
128 | | #endif // _LOG4CXX_HTML_LAYOUT_H |