File: Poco.NestedDiagnosticContext.html

package info (click to toggle)
poco-doc 1.3.6-1
  • links: PTS
  • area: main
  • in suites: buster, jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 10,076 kB
  • ctags: 9,611
  • sloc: makefile: 31
file content (111 lines) | stat: -rw-r--r-- 8,016 bytes parent folder | download | duplicates (2)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Class Poco::NestedDiagnosticContext</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
<meta name="author" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="publisher" content="Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="copyright" content="Copyright (c) 2009, Applied Informatics Software Engineering GmbH and Contributors"/>
<meta name="language" content="en"/>
<meta name="date" content="2009-11-24"/>
<meta name="generator" content="PocoDoc"/>
<link rel="stylesheet" href="css/styles.css" type="text/css"/>
</head>
<body bgcolor="#ffffff" leftmargin="0" topmargin="0">
<div class="header">
<h1 class="namespace"><a href="Poco.html" class="namespace">Poco</a></h1>
<h1 class="symbol">class NestedDiagnosticContext</h1>
</div>
<div class="body">
<p>
<b>Library:</b> Foundation<br />
<b>Package:</b> Core<br />
<b>Header:</b> Poco/NestedDiagnosticContext.h</p>
<h2>Description</h2>
<div class="description">
<p>This class implements a Nested Diagnostic <a href="Poco.NestedDiagnosticContext.Context.html" title="struct Poco::NestedDiagnosticContext::Context">Context</a> (<a href="Poco.html#8776" title="Poco::NDC">NDC</a>), as described in Neil Harrison's article &quot;Patterns for Logging  Diagnostic Messages&quot; in &quot;Pattern Languages of Program Design 3&quot; (Addison-Wesley). </p>
<p>A <a href="Poco.html#8776" title="Poco::NDC">NDC</a> maintains a stack of context information, consisting of an informational string (e.g., a method name), as well as an optional source code line number and file name. NDCs are especially useful for tagging log messages with context information which is very helpful in a multithreaded server scenario. Every thread has its own private <a href="Poco.html#8776" title="Poco::NDC">NDC</a>, which is automatically created when needed and destroyed when the thread terminates. </p>
<p>The <a href="Poco.NDCScope.html" title="class Poco::NDCScope">NDCScope</a> (or NDC::<a href="Poco.NestedDiagnosticContext.html#8747" title="Poco::NestedDiagnosticContext::Scope">Scope</a>) class can be used to automatically push information at the beginning of a scope, and to pop it at the end. The poco_ndc(info) macro augments the information with a source code line number and file name. </p>
</div>
<h2>Member Summary</h2>
<p><b>Member Functions: </b><a href="Poco.NestedDiagnosticContext.html#8768" title="Poco::NestedDiagnosticContext::clear()">clear</a>, <a href="Poco.NestedDiagnosticContext.html#8769" title="Poco::NestedDiagnosticContext::current()">current</a>, <a href="Poco.NestedDiagnosticContext.html#8761" title="Poco::NestedDiagnosticContext::depth()">depth</a>, <a href="Poco.NestedDiagnosticContext.html#8763" title="Poco::NestedDiagnosticContext::dump()">dump</a>, <a href="Poco.NestedDiagnosticContext.html#8752" title="Poco::NestedDiagnosticContext::operator =()">operator&nbsp;=</a>, <a href="Poco.NestedDiagnosticContext.html#8760" title="Poco::NestedDiagnosticContext::pop()">pop</a>, <a href="Poco.NestedDiagnosticContext.html#8754" title="Poco::NestedDiagnosticContext::push()">push</a>, <a href="Poco.NestedDiagnosticContext.html#8762" title="Poco::NestedDiagnosticContext::toString()">toString</a></p>
<h2>Types</h2>
<h3><a name="8747">Scope</a></h3>
<p class="decl">typedef <a href="Poco.NDCScope.html" title="class Poco::NDCScope">NDCScope</a> <a href="Poco.NestedDiagnosticContext.html#8747" title="Poco::NestedDiagnosticContext::Scope">Scope</a>;</p>
<div class="description">
<p></p>
</div>
<h2>Constructors</h2>
<h3><a name="8748">NestedDiagnosticContext</a></h3>
<p class="decl"><a href="Poco.NestedDiagnosticContext.html" title="class Poco::NestedDiagnosticContext">NestedDiagnosticContext</a>();</p>
<div class="description">
<p>Creates the <a href="Poco.NestedDiagnosticContext.html" title="class Poco::NestedDiagnosticContext">NestedDiagnosticContext</a>. </p>
</div>
<h3><a name="8749">NestedDiagnosticContext</a></h3>
<p class="decl"><a href="Poco.NestedDiagnosticContext.html" title="class Poco::NestedDiagnosticContext">NestedDiagnosticContext</a>(<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.NestedDiagnosticContext.html" title="class Poco::NestedDiagnosticContext">NestedDiagnosticContext</a> &amp; ctx<br />);</p>
<div class="description">
<p>Copy constructor. </p>
</div>
<h2>Destructor</h2>
<h3><a name="8751">~NestedDiagnosticContext</a></h3>
<p class="decl">~<a href="Poco.NestedDiagnosticContext.html" title="class Poco::NestedDiagnosticContext">NestedDiagnosticContext</a>();</p>
<div class="description">
<p>Destroys the <a href="Poco.NestedDiagnosticContext.html" title="class Poco::NestedDiagnosticContext">NestedDiagnosticContext</a>. </p>
</div>
<h2>Member Functions</h2>
<h3><a name="8768">clear</a></h3>
<p class="decl">void clear();</p>
<div class="description">
<p>Clears the <a href="Poco.html#8776" title="Poco::NDC">NDC</a> stack. </p>
</div>
<h3><a name="8769">current</a> <img src="images/static.gif" alt="static" title="static" style="vertical-align:baseline;" border="0" /> </h3>
<p class="decl">static <a href="Poco.NestedDiagnosticContext.html" title="class Poco::NestedDiagnosticContext">NestedDiagnosticContext</a> &amp; current();</p>
<div class="description">
<p>Returns the current thread's <a href="Poco.html#8776" title="Poco::NDC">NDC</a>. </p>
</div>
<h3><a name="8761">depth</a></h3>
<p class="decl">int depth() const;</p>
<div class="description">
<p>Returns the depth (number of contexts) of the stack. </p>
</div>
<h3><a name="8763">dump</a></h3>
<p class="decl">void dump(<br />&nbsp;&nbsp;&nbsp;&nbsp;std::ostream &amp; ostr<br />) const;</p>
<div class="description">
<p>Dumps the stack (including line number and filenames) to the given stream. The entries are delimited by a newline. </p>
</div>
<h3><a name="8765">dump</a></h3>
<p class="decl">void dump(<br />&nbsp;&nbsp;&nbsp;&nbsp;std::ostream &amp; ostr,<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; delimiter<br />) const;</p>
<div class="description">
<p>Dumps the stack (including line number and filenames) to the given stream. </p>
</div>
<h3><a name="8752">operator =</a></h3>
<p class="decl"><a href="Poco.NestedDiagnosticContext.html" title="class Poco::NestedDiagnosticContext">NestedDiagnosticContext</a> &amp; operator = (<br />&nbsp;&nbsp;&nbsp;&nbsp;const <a href="Poco.NestedDiagnosticContext.html" title="class Poco::NestedDiagnosticContext">NestedDiagnosticContext</a> &amp; ctx<br />);</p>
<div class="description">
<p>Assignment operator. </p>
</div>
<h3><a name="8760">pop</a></h3>
<p class="decl">void pop();</p>
<div class="description">
<p>Pops the top-most context off the stack. </p>
</div>
<h3><a name="8754">push</a></h3>
<p class="decl">void push(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; info<br />);</p>
<div class="description">
<p>Pushes a context (without line number and filename) onto the stack. </p>
</div>
<h3><a name="8756">push</a></h3>
<p class="decl">void push(<br />&nbsp;&nbsp;&nbsp;&nbsp;const std::string &amp; info,<br />&nbsp;&nbsp;&nbsp;&nbsp;int line,<br />&nbsp;&nbsp;&nbsp;&nbsp;const char * filename<br />);</p>
<div class="description">
<p>Pushes a context (including line number and filename)  onto the stack. Filename must be a static string, such as the one produced by the __FILE__ preprocessor macro. </p>
</div>
<h3><a name="8762">toString</a></h3>
<p class="decl">std::string toString() const;</p>
<div class="description">
<p>Returns the stack as a string with entries delimited by colons. The string does not contain line numbers and filenames. </p>
</div>
<p class="footer">POCO C++ Libraries 1.3.6-all<br />
Copyright &copy; 2009, <a href="http://pocoproject.org/" target="_blank">Applied Informatics Software Engineering GmbH and Contributors</a></p>

</div>
</body>
</html>