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 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>log4cpp: Category.hh Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.4.2 -->
<div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="dirs.html">Directories</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div>
<div class="nav">
<a class="el" href="dir_000001.html">include</a> / <a class="el" href="dir_000002.html">log4cpp</a></div>
<h1>Category.hh</h1><a href="Category_8hh.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment">00001 <span class="comment">/*</span>
00002 <span class="comment"> * Category.hh</span>
00003 <span class="comment"> *</span>
00004 <span class="comment"> * Copyright 2000, LifeLine Networks BV (www.lifeline.nl). All rights reserved.</span>
00005 <span class="comment"> * Copyright 2000, Bastiaan Bakker. All rights reserved.</span>
00006 <span class="comment"> *</span>
00007 <span class="comment"> * See the COPYING file for the terms of usage and distribution.</span>
00008 <span class="comment"> */</span>
00009
00010 <span class="preprocessor">#ifndef _LOG4CPP_CATEGORY_HH</span>
00011 <span class="preprocessor"></span><span class="preprocessor">#define _LOG4CPP_CATEGORY_HH</span>
00012 <span class="preprocessor"></span>
00013 <span class="preprocessor">#include <<a class="code" href="Portability_8hh.html">log4cpp/Portability.hh</a>></span>
00014 <span class="preprocessor">#include <<a class="code" href="Appender_8hh.html">log4cpp/Appender.hh</a>></span>
00015 <span class="preprocessor">#include <<a class="code" href="LoggingEvent_8hh.html">log4cpp/LoggingEvent.hh</a>></span>
00016 <span class="preprocessor">#include <<a class="code" href="Priority_8hh.html">log4cpp/Priority.hh</a>></span>
00017 <span class="preprocessor">#include <<a class="code" href="CategoryStream_8hh.html">log4cpp/CategoryStream.hh</a>></span>
00018 <span class="preprocessor">#include <<a class="code" href="Threading_8hh.html">log4cpp/threading/Threading.hh</a>></span>
00019
00020 <span class="preprocessor">#include <map></span>
00021 <span class="preprocessor">#include <vector></span>
00022 <span class="preprocessor">#include <cstdarg></span>
00023 <span class="preprocessor">#include <stdexcept></span>
00024
00025 <span class="keyword">namespace </span>log4cpp {
00026
<a name="l00032"></a><a class="code" href="classlog4cpp_1_1Category.html">00032</a> <span class="keyword">class </span><a class="code" href="Export_8hh.html#a0">LOG4CPP_EXPORT</a> Category {
<a name="l00033"></a><a class="code" href="classlog4cpp_1_1Category.html#n0">00033</a> <span class="keyword">friend</span> <span class="keyword">class </span><a class="code" href="classlog4cpp_1_1HierarchyMaintainer.html">HierarchyMaintainer</a>;
00034
00035 <span class="keyword">public</span>:
00047 <span class="keyword">static</span> Category& getRoot();
00048
00053 <span class="keyword">static</span> <span class="keywordtype">void</span> setRootPriority(<a class="code" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> priority);
00054
00059 <span class="keyword">static</span> <a class="code" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> getRootPriority() throw();
00060
00068 static Category& getInstance(const std::string& name);
00069
00075 static Category* exists(const std::string& name);
00076
00089 static std::vector<Category*>* getCurrentCategories();
00090
00094 static <span class="keywordtype">void</span> shutdown();
00095
00099 virtual ~Category();
00100
00105 virtual const std::string& getName() const throw();
00106
00114 virtual <span class="keywordtype">void</span> setPriority(<a class="code" href="classlog4cpp_1_1Priority.html">Priority</a>::Value priority)
00115 throw(std::invalid_argument);
00116
00121 virtual <a class="code" href="classlog4cpp_1_1Priority.html">Priority</a>::Value getPriority() const throw();
00122
00131 virtual <a class="code" href="classlog4cpp_1_1Priority.html">Priority</a>::Value getChainedPriority() const throw();
00132
00139 virtual <span class="keywordtype">bool</span> isPriorityEnabled(<a class="code" href="classlog4cpp_1_1Priority.html">Priority</a>::Value priority) const throw();
00140
00148 virtual <span class="keywordtype">void</span> addAppender(<a class="code" href="classlog4cpp_1_1Appender.html">Appender</a>* appender)
00149 throw(std::invalid_argument);
00150
00157 virtual <span class="keywordtype">void</span> addAppender(<a class="code" href="classlog4cpp_1_1Appender.html">Appender</a>& appender);
00158
<a name="l00167"></a><a class="code" href="classlog4cpp_1_1Category.html#a8">00167</a> inline <span class="keywordtype">void</span> setAppender(<a class="code" href="classlog4cpp_1_1Appender.html">Appender</a>* appender) {
00168 <span class="keywordflow">if</span> (appender) {
00169 addAppender(appender);
00170 } <span class="keywordflow">else</span> {
00171 removeAllAppenders();
00172 }
00173 };
00174
<a name="l00181"></a><a class="code" href="classlog4cpp_1_1Category.html#a9">00181</a> <span class="keyword">inline</span> <span class="keywordtype">void</span> setAppender(<a class="code" href="classlog4cpp_1_1Appender.html">Appender</a>& appender) {
00182 addAppender(appender);
00183 };
00184
00191 <span class="keyword">virtual</span> <a class="code" href="classlog4cpp_1_1Appender.html">Appender</a>* getAppender() <span class="keyword">const</span>;
00192
00199 <span class="keyword">virtual</span> <a class="code" href="classlog4cpp_1_1Appender.html">Appender</a>* getAppender(<span class="keyword">const</span> std::string& name) <span class="keyword">const</span>;
00200
00206 <span class="keyword">virtual</span> <a class="code" href="namespacelog4cpp.html#a1">AppenderSet</a> getAllAppenders() <span class="keyword">const</span>;
00207
00211 <span class="keyword">virtual</span> <span class="keywordtype">void</span> removeAllAppenders();
00212
00217 <span class="keyword">virtual</span> <span class="keywordtype">void</span> removeAppender(<a class="code" href="classlog4cpp_1_1Appender.html">Appender</a>* appender);
00218
<a name="l00225"></a><a class="code" href="classlog4cpp_1_1Category.html#a15">00225</a> <span class="keyword">inline</span> <span class="keywordtype">bool</span> ownsAppender() const throw() {
00226 <span class="keywordflow">return</span> ownsAppender(getAppender());
00227 };
00228
00234 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> ownsAppender(<a class="code" href="classlog4cpp_1_1Appender.html">Appender</a>* appender) <span class="keyword">const</span> <span class="keywordflow">throw</span>();
00235
00247 <span class="keyword">virtual</span> <span class="keywordtype">void</span> callAppenders(<span class="keyword">const</span> <a class="code" href="structlog4cpp_1_1LoggingEvent.html">LoggingEvent</a>& event) <span class="keywordflow">throw</span>();
00248
00252 <span class="keyword">virtual</span> <span class="keywordtype">void</span> setAdditivity(<span class="keywordtype">bool</span> additivity);
00253
00257 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> getAdditivity() const throw();
00258
00264 virtual Category* getParent() throw();
00265
00271 virtual const Category* getParent() const throw();
00272
00280 virtual <span class="keywordtype">void</span> log(<a class="code" href="classlog4cpp_1_1Priority.html">Priority</a>::Value priority, const <span class="keywordtype">char</span>* stringFormat,
00281 ...) throw();
00282
00288 virtual <span class="keywordtype">void</span> log(<a class="code" href="classlog4cpp_1_1Priority.html">Priority</a>::Value priority,
00289 const std::string& message) throw();
00290
00299 virtual <span class="keywordtype">void</span> logva(<a class="code" href="classlog4cpp_1_1Priority.html">Priority</a>::Value priority,
00300 const <span class="keywordtype">char</span>* stringFormat,
00301 va_list va) throw();
00302
00309 <span class="keywordtype">void</span> debug(const <span class="keywordtype">char</span>* stringFormat, ...) throw();
00310
00315 <span class="keywordtype">void</span> debug(const std::string& message) throw();
00316
<a name="l00321"></a><a class="code" href="classlog4cpp_1_1Category.html#a27">00321</a> inline <span class="keywordtype">bool</span> isDebugEnabled() const throw() {
00322 <span class="keywordflow">return</span> isPriorityEnabled(<a class="code" href="classlog4cpp_1_1Priority.html#w11w9">Priority::DEBUG</a>);
00323 };
00324
<a name="l00329"></a><a class="code" href="classlog4cpp_1_1Category.html#a28">00329</a> <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html">CategoryStream</a> debugStream() {
00330 <span class="keywordflow">return</span> getStream(<a class="code" href="classlog4cpp_1_1Priority.html#w11w9">Priority::DEBUG</a>);
00331 }
00332
00339 <span class="keywordtype">void</span> info(<span class="keyword">const</span> <span class="keywordtype">char</span>* stringFormat, ...) throw();
00340
00345 <span class="keywordtype">void</span> info(const std::string& message) throw();
00346
<a name="l00351"></a><a class="code" href="classlog4cpp_1_1Category.html#a31">00351</a> inline <span class="keywordtype">bool</span> isInfoEnabled() const throw() {
00352 <span class="keywordflow">return</span> isPriorityEnabled(<a class="code" href="classlog4cpp_1_1Priority.html#w11w8">Priority::INFO</a>);
00353 };
00354
<a name="l00359"></a><a class="code" href="classlog4cpp_1_1Category.html#a32">00359</a> <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html">CategoryStream</a> infoStream() {
00360 <span class="keywordflow">return</span> getStream(<a class="code" href="classlog4cpp_1_1Priority.html#w11w8">Priority::INFO</a>);
00361 }
00362
00369 <span class="keywordtype">void</span> notice(<span class="keyword">const</span> <span class="keywordtype">char</span>* stringFormat, ...) throw();
00370
00375 <span class="keywordtype">void</span> notice(const std::string& message) throw();
00376
<a name="l00381"></a><a class="code" href="classlog4cpp_1_1Category.html#a35">00381</a> inline <span class="keywordtype">bool</span> isNoticeEnabled() const throw() {
00382 <span class="keywordflow">return</span> isPriorityEnabled(<a class="code" href="classlog4cpp_1_1Priority.html#w11w7">Priority::NOTICE</a>);
00383 };
00384
<a name="l00389"></a><a class="code" href="classlog4cpp_1_1Category.html#a36">00389</a> <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html">CategoryStream</a> noticeStream() {
00390 <span class="keywordflow">return</span> getStream(<a class="code" href="classlog4cpp_1_1Priority.html#w11w7">Priority::NOTICE</a>);
00391 }
00392
00399 <span class="keywordtype">void</span> warn(<span class="keyword">const</span> <span class="keywordtype">char</span>* stringFormat, ...) throw();
00400
00405 <span class="keywordtype">void</span> warn(const std::string& message) throw();
00406
<a name="l00411"></a><a class="code" href="classlog4cpp_1_1Category.html#a39">00411</a> inline <span class="keywordtype">bool</span> isWarnEnabled() const throw() {
00412 <span class="keywordflow">return</span> isPriorityEnabled(<a class="code" href="classlog4cpp_1_1Priority.html#w11w6">Priority::WARN</a>);
00413 };
00414
<a name="l00419"></a><a class="code" href="classlog4cpp_1_1Category.html#a40">00419</a> <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html">CategoryStream</a> warnStream() {
00420 <span class="keywordflow">return</span> getStream(<a class="code" href="classlog4cpp_1_1Priority.html#w11w6">Priority::WARN</a>);
00421 };
00422
00429 <span class="keywordtype">void</span> error(<span class="keyword">const</span> <span class="keywordtype">char</span>* stringFormat, ...) throw();
00430
00435 <span class="keywordtype">void</span> error(const std::string& message) throw();
00436
<a name="l00441"></a><a class="code" href="classlog4cpp_1_1Category.html#a43">00441</a> inline <span class="keywordtype">bool</span> isErrorEnabled() const throw() {
00442 <span class="keywordflow">return</span> isPriorityEnabled(<a class="code" href="classlog4cpp_1_1Priority.html#w11w5">Priority::ERROR</a>);
00443 };
00444
<a name="l00449"></a><a class="code" href="classlog4cpp_1_1Category.html#a44">00449</a> <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html">CategoryStream</a> errorStream() {
00450 <span class="keywordflow">return</span> getStream(<a class="code" href="classlog4cpp_1_1Priority.html#w11w5">Priority::ERROR</a>);
00451 };
00452
00459 <span class="keywordtype">void</span> crit(<span class="keyword">const</span> <span class="keywordtype">char</span>* stringFormat, ...) throw();
00460
00465 <span class="keywordtype">void</span> crit(const std::string& message) throw();
00466
<a name="l00471"></a><a class="code" href="classlog4cpp_1_1Category.html#a47">00471</a> inline <span class="keywordtype">bool</span> isCritEnabled() const throw() {
00472 <span class="keywordflow">return</span> isPriorityEnabled(<a class="code" href="classlog4cpp_1_1Priority.html#w11w4">Priority::CRIT</a>);
00473 };
00474
<a name="l00479"></a><a class="code" href="classlog4cpp_1_1Category.html#a48">00479</a> <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html">CategoryStream</a> critStream() {
00480 <span class="keywordflow">return</span> getStream(<a class="code" href="classlog4cpp_1_1Priority.html#w11w4">Priority::CRIT</a>);
00481 };
00482
00489 <span class="keywordtype">void</span> alert(<span class="keyword">const</span> <span class="keywordtype">char</span>* stringFormat, ...) throw();
00490
00495 <span class="keywordtype">void</span> alert(const std::string& message) throw();
00496
<a name="l00501"></a><a class="code" href="classlog4cpp_1_1Category.html#a51">00501</a> inline <span class="keywordtype">bool</span> isAlertEnabled() const throw() {
00502 <span class="keywordflow">return</span> isPriorityEnabled(<a class="code" href="classlog4cpp_1_1Priority.html#w11w3">Priority::ALERT</a>);
00503 };
00504
<a name="l00509"></a><a class="code" href="classlog4cpp_1_1Category.html#a52">00509</a> <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html">CategoryStream</a> alertStream() throw() {
00510 <span class="keywordflow">return</span> getStream(<a class="code" href="classlog4cpp_1_1Priority.html#w11w3">Priority::ALERT</a>);
00511 };
00512
00519 <span class="keywordtype">void</span> emerg(<span class="keyword">const</span> <span class="keywordtype">char</span>* stringFormat, ...) throw();
00520
00525 <span class="keywordtype">void</span> emerg(const std::string& message) throw();
00526
<a name="l00531"></a><a class="code" href="classlog4cpp_1_1Category.html#a55">00531</a> inline <span class="keywordtype">bool</span> isEmergEnabled() const throw() {
00532 <span class="keywordflow">return</span> isPriorityEnabled(<a class="code" href="classlog4cpp_1_1Priority.html#w11w1">Priority::EMERG</a>);
00533 };
00534
<a name="l00539"></a><a class="code" href="classlog4cpp_1_1Category.html#a56">00539</a> <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html">CategoryStream</a> emergStream() {
00540 <span class="keywordflow">return</span> getStream(<a class="code" href="classlog4cpp_1_1Priority.html#w11w1">Priority::EMERG</a>);
00541 };
00542
00551 <span class="keywordtype">void</span> fatal(<span class="keyword">const</span> <span class="keywordtype">char</span>* stringFormat, ...) throw();
00552
00559 <span class="keywordtype">void</span> fatal(const std::string& message) throw();
00560
<a name="l00567"></a><a class="code" href="classlog4cpp_1_1Category.html#a59">00567</a> inline <span class="keywordtype">bool</span> isFatalEnabled() const throw() {
00568 <span class="keywordflow">return</span> isPriorityEnabled(<a class="code" href="classlog4cpp_1_1Priority.html#w11w2">Priority::FATAL</a>);
00569 };
00570
<a name="l00577"></a><a class="code" href="classlog4cpp_1_1Category.html#a60">00577</a> <span class="keyword">inline</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html">CategoryStream</a> fatalStream() {
00578 <span class="keywordflow">return</span> getStream(<a class="code" href="classlog4cpp_1_1Priority.html#w11w2">Priority::FATAL</a>);
00579 };
00580
00586 <span class="keyword">virtual</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html">CategoryStream</a> getStream(<a class="code" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> priority);
00587
00593 <span class="keyword">virtual</span> <a class="code" href="classlog4cpp_1_1CategoryStream.html">CategoryStream</a> <a class="code" href="namespacelog4cpp.html#a7">operator<<</a>(<a class="code" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> priority);
00594
00595 <span class="keyword">protected</span>:
00596
00605 <a class="code" href="namespacelog4cpp.html#a2">Category</a>(<span class="keyword">const</span> std::string& name, Category* parent,
00606 <a class="code" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> priority = <a class="code" href="classlog4cpp_1_1Priority.html#w11w10">Priority::NOTSET</a>);
00607
00608 <span class="keyword">virtual</span> <span class="keywordtype">void</span> _logUnconditionally(<a class="code" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> priority,
00609 <span class="keyword">const</span> <span class="keywordtype">char</span>* format,
00610 va_list arguments) <span class="keywordflow">throw</span>();
00611
00617 <span class="keyword">virtual</span> <span class="keywordtype">void</span> _logUnconditionally2(<a class="code" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> priority,
00618 <span class="keyword">const</span> std::string& message) <span class="keywordflow">throw</span>();
00619
00620 <span class="keyword">private</span>:
00621
00622 <span class="comment">/* prevent copying and assignment */</span>
00623 <a class="code" href="namespacelog4cpp.html#a2">Category</a>(<span class="keyword">const</span> Category& other);
00624 Category& operator=(<span class="keyword">const</span> Category& other);
00625
00627 <span class="keyword">const</span> std::string _name;
00628
00633 Category* _parent;
00634
00638 <span class="keyword">volatile</span> <a class="code" href="classlog4cpp_1_1Priority.html#w0">Priority::Value</a> _priority;
00639
00640 <span class="keyword">typedef</span> std::map<Appender *, bool> OwnsAppenderMap;
00641
00648 <span class="keyword">virtual</span> <span class="keywordtype">bool</span> ownsAppender(<a class="code" href="classlog4cpp_1_1Appender.html">Appender</a>* appender,
00649 OwnsAppenderMap::iterator& i2) <span class="keywordflow">throw</span>();
00650
00651 <a class="code" href="namespacelog4cpp.html#a1">AppenderSet</a> _appender;
00652 <span class="keyword">mutable</span> <a class="code" href="classlog4cpp_1_1threading_1_1Mutex.html">threading::Mutex</a> _appenderSetMutex;
00653
00659 OwnsAppenderMap _ownsAppender;
00660
00665 <span class="keyword">volatile</span> <span class="keywordtype">bool</span> _isAdditive;
00666
00667 };
00668
00669 }
00670 <span class="preprocessor">#endif // _LOG4CPP_CATEGORY_HH</span>
</pre></div><hr size="1"><address style="align: right;"><small>Generated on Fri Jul 29 14:07:33 2005 for log4cpp by
<a href="http://www.doxygen.org/index.html">
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.2 </small></address>
</body>
</html>
|