1<?xml version="1.0" standalone="yes"?> 2<library-reference id="core_components"><title>Core components</title><header name="boost/log/core/core.hpp"> 3<para><para>Andrey Semashev </para> 4 5<para>19.04.2007</para> 6 7This header contains logging core class definition. </para><namespace name="boost"> 8<namespace name="log"> 9<class name="core"><purpose>Logging library core class. </purpose><description><para>The logging core is used to interconnect log sources and sinks. It also provides a number of basic features, like global filtering and global and thread-specific attribute storage.</para><para>The logging core is a singleton. Users can acquire the core instance by calling the static method <computeroutput>get</computeroutput>. </para></description><typedef name="exception_handler_type"><purpose>Exception handler function type. </purpose><type><emphasis>unspecified</emphasis></type></typedef> 10<method-group name="public member functions"> 11<method name="set_logging_enabled"><type>bool</type><parameter name="enabled"><paramtype>bool</paramtype><default>true</default><description><para>The actual flag of logging activity. </para></description></parameter><description><para>The method enables or disables logging.</para><para>Setting this status to <computeroutput>false</computeroutput> allows you to completely wipe out any logging activity, including filtering and generation of attribute values. It is useful if you want to completely disable logging in a running application. The state of logging does not alter any other properties of the logging library, such as filters or sinks, so you can enable logging with the very same settings that you had when the logging was disabled. This feature may also be useful if you want to perform major changes to logging configuration and don't want your application to block on opening or pushing a log record.</para><para>By default logging is enabled.</para><para> 12 13</para></description><returns><para>The previous value of enabled/disabled logging flag </para> 14</returns></method> 15<method name="get_logging_enabled" cv="const"><type>bool</type><description><para>The method allows to detect if logging is enabled. See the comment for <computeroutput>set_logging_enabled</computeroutput>. </para></description></method> 16<method name="set_filter"><type>void</type><parameter name="filter"><paramtype>filter const &</paramtype><description><para>The filter function object to be installed. </para></description></parameter><description><para>The method sets the global logging filter. The filter is applied to every log record that is processed.</para><para> 17</para></description></method> 18<method name="reset_filter"><type>void</type><description><para>The method removes the global logging filter. All log records are passed to sinks without global filtering applied. </para></description></method> 19<method name="add_sink"><type>void</type><parameter name="s"><paramtype>shared_ptr< sinks::sink > const &</paramtype><description><para>The sink to be registered. </para></description></parameter><description><para>The method adds a new sink. The sink is included into logging process immediately after being added and until being removed. No sink can be added more than once at the same time. If the sink is already registered, the call is ignored.</para><para> 20</para></description></method> 21<method name="remove_sink"><type>void</type><parameter name="s"><paramtype>shared_ptr< sinks::sink > const &</paramtype><description><para>The sink to be unregistered. </para></description></parameter><description><para>The method removes the sink from the output. The sink will not receive any log records after removal. The call has no effect if the sink is not registered.</para><para> 22</para></description></method> 23<method name="remove_all_sinks"><type>void</type><description><para>The method removes all registered sinks from the output. The sinks will not receive any log records after removal. </para></description></method> 24<method name="flush"><type>void</type><description><para>The method performs flush on all registered sinks.</para><para><note><para>This method may take long time to complete as it may block until all sinks manage to process all buffered log records. The call will also block all logging attempts until the operation completes. </para> 25</note> 26</para></description></method> 27<method name="add_global_attribute"><type>std::pair< attribute_set::iterator, bool ></type><parameter name="name"><paramtype>attribute_name const &</paramtype><description><para>The attribute name. </para></description></parameter><parameter name="attr"><paramtype>attribute const &</paramtype><description><para>The attribute factory. </para></description></parameter><description><para>The method adds an attribute to the global attribute set. The attribute will be implicitly added to every log record.</para><para> 28 29</para></description><returns><para>A pair of values. If the second member is <computeroutput>true</computeroutput>, then the attribute is added and the first member points to the attribute. Otherwise the attribute was not added and the first member points to the attribute that prevents addition. </para> 30</returns></method> 31<method name="remove_global_attribute"><type>void</type><parameter name="it"><paramtype>attribute_set::iterator</paramtype><description><para>Iterator to the previously added attribute. </para></description></parameter><description><para>The method removes an attribute from the global attribute set.</para><para> 32 33 34</para></description><requires><para>The attribute was added with the <computeroutput>add_global_attribute</computeroutput> call. </para> 35</requires><postconditions><para>The attribute is no longer registered as a global attribute. The iterator is invalidated after removal.</para> 36</postconditions></method> 37<method name="get_global_attributes" cv="const"><type>attribute_set</type><description><para>The method returns a copy of the complete set of currently registered global attributes. </para></description></method> 38<method name="set_global_attributes"><type>void</type><parameter name="attrs"><paramtype>attribute_set const &</paramtype><description><para>The set of attributes to be installed. </para></description></parameter><description><para>The method replaces the complete set of currently registered global attributes with the provided set.</para><para><note><para>The method invalidates all iterators and references that may have been returned from the <computeroutput>add_global_attribute</computeroutput> method.</para> 39</note> 40 41</para></description></method> 42<method name="add_thread_attribute"><type>std::pair< attribute_set::iterator, bool ></type><parameter name="name"><paramtype>attribute_name const &</paramtype><description><para>The attribute name. </para></description></parameter><parameter name="attr"><paramtype>attribute const &</paramtype><description><para>The attribute factory. </para></description></parameter><description><para>The method adds an attribute to the thread-specific attribute set. The attribute will be implicitly added to every log record made in the current thread.</para><para><note><para>In single-threaded build the effect is the same as adding the attribute globally. This, however, does not imply that iterators to thread-specific and global attributes are interchangeable.</para> 43</note> 44 45 46</para></description><returns><para>A pair of values. If the second member is <computeroutput>true</computeroutput>, then the attribute is added and the first member points to the attribute. Otherwise the attribute was not added and the first member points to the attribute that prevents addition. </para> 47</returns></method> 48<method name="remove_thread_attribute"><type>void</type><parameter name="it"><paramtype>attribute_set::iterator</paramtype><description><para>Iterator to the previously added attribute. </para></description></parameter><description><para>The method removes an attribute from the thread-specific attribute set.</para><para> 49 50 51</para></description><requires><para>The attribute was added with the <computeroutput>add_thread_attribute</computeroutput> call. </para> 52</requires><postconditions><para>The attribute is no longer registered as a thread-specific attribute. The iterator is invalidated after removal.</para> 53</postconditions></method> 54<method name="get_thread_attributes" cv="const"><type>attribute_set</type><description><para>The method returns a copy of the complete set of currently registered thread-specific attributes. </para></description></method> 55<method name="set_thread_attributes"><type>void</type><parameter name="attrs"><paramtype>attribute_set const &</paramtype><description><para>The set of attributes to be installed. </para></description></parameter><description><para>The method replaces the complete set of currently registered thread-specific attributes with the provided set.</para><para><note><para>The method invalidates all iterators and references that may have been returned from the <computeroutput>add_thread_attribute</computeroutput> method.</para> 56</note> 57 58</para></description></method> 59<method name="set_exception_handler"><type>void</type><parameter name="handler"><paramtype>exception_handler_type const &</paramtype><description><para>Exception handling function</para></description></parameter><description><para>The method sets exception handler function. The function will be called with no arguments in case if an exception occurs during either <computeroutput>open_record</computeroutput> or <computeroutput>push_record</computeroutput> method execution. Since exception handler is called from a <computeroutput>catch</computeroutput> statement, the exception can be rethrown in order to determine its type.</para><para>By default no handler is installed, thus any exception is propagated as usual.</para><para><para><emphasis role="bold">See Also:</emphasis><para>See also: <computeroutput>utility/exception_handler.hpp</computeroutput> </para> 60</para> 61 62<note><para>The exception handler can be invoked in several threads concurrently. Thread interruptions are not affected by exception handlers. </para> 63</note> 64</para></description></method> 65<method name="open_record"><type><classname>record</classname></type><parameter name="source_attributes"><paramtype>attribute_set const &</paramtype><description><para>The set of source-specific attributes to be attached to the record to be opened. </para></description></parameter><description><para>The method attempts to open a new record to be written. While attempting to open a log record all filtering is applied. A successfully opened record can be pushed further to sinks by calling the <computeroutput>push_record</computeroutput> method or simply destroyed by destroying the returned object.</para><para>More than one open records are allowed, such records exist independently. All attribute values are acquired during opening the record and do not interact between records.</para><para>The returned records can be copied, however, they must not be passed between different threads.</para><para> 66 67<emphasis role="bold">Throws:</emphasis> If an exception handler is installed, only throws if the handler throws. Otherwise may throw if one of the sinks throws, or some system resource limitation is reached. </para></description><returns><para>A valid log record if the record is opened, an invalid record object if not (e.g. because it didn't pass filtering).</para> 68</returns></method> 69<method name="open_record"><type><classname>record</classname></type><parameter name="source_attributes"><paramtype>attribute_value_set const &</paramtype><description><para>The set of source-specific attribute values to be attached to the record to be opened. </para></description></parameter><description><para>The method attempts to open a new record to be written. While attempting to open a log record all filtering is applied. A successfully opened record can be pushed further to sinks by calling the <computeroutput>push_record</computeroutput> method or simply destroyed by destroying the returned object.</para><para>More than one open records are allowed, such records exist independently. All attribute values are acquired during opening the record and do not interact between records.</para><para>The returned records can be copied, however, they must not be passed between different threads.</para><para> 70 71<emphasis role="bold">Throws:</emphasis> If an exception handler is installed, only throws if the handler throws. Otherwise may throw if one of the sinks throws, or some system resource limitation is reached. </para></description><returns><para>A valid log record if the record is opened, an invalid record object if not (e.g. because it didn't pass filtering).</para> 72</returns></method> 73<method name="open_record"><type><classname>record</classname></type><parameter name="source_attributes"><paramtype>attribute_value_set &&</paramtype><description><para>The set of source-specific attribute values to be attached to the record to be opened. The contents of this container are unspecified after this call. </para></description></parameter><description><para>The method attempts to open a new record to be written. While attempting to open a log record all filtering is applied. A successfully opened record can be pushed further to sinks by calling the <computeroutput>push_record</computeroutput> method or simply destroyed by destroying the returned object.</para><para>More than one open records are allowed, such records exist independently. All attribute values are acquired during opening the record and do not interact between records.</para><para>The returned records can be copied, however, they must not be passed between different threads.</para><para> 74 75<emphasis role="bold">Throws:</emphasis> If an exception handler is installed, only throws if the handler throws. Otherwise may throw if one of the sinks throws, or some system resource limitation is reached. </para></description><returns><para>A valid log record if the record is opened, an invalid record object if not (e.g. because it didn't pass filtering).</para> 76</returns></method> 77<method name="push_record"><type>void</type><parameter name="rec"><paramtype><classname>record</classname> &&</paramtype><description><para>A previously successfully opened log record.</para></description></parameter><description><para>The method pushes the record to sinks. The record is moved from in the process.</para><para> 78 79 80<emphasis role="bold">Throws:</emphasis> If an exception handler is installed, only throws if the handler throws. Otherwise may throw if one of the sinks throws. </para></description><requires><para><computeroutput>!!rec == true</computeroutput> </para> 81</requires><postconditions><para><computeroutput>!rec == true</computeroutput> </para> 82</postconditions></method> 83</method-group> 84<destructor><description><para>Destructor. Destroys the core, releases any sinks and attributes that were registered. </para></description></destructor> 85<constructor cv="= delete"><parameter name=""><paramtype><classname>core</classname> const &</paramtype></parameter></constructor> 86<copy-assignment cv="= delete"><type><classname>core</classname> &</type><parameter name=""><paramtype><classname>core</classname> const &</paramtype></parameter></copy-assignment> 87<method-group name="public static functions"> 88<method name="get" specifiers="static"><type>core_ptr</type><description><para> 89</para></description><returns><para>The method returns a pointer to the logging core singleton instance. </para> 90</returns></method> 91</method-group> 92</class><typedef name="core_ptr"><type>shared_ptr< <classname>core</classname> ></type></typedef> 93 94 95</namespace> 96</namespace> 97</header> 98<header name="boost/log/core/record.hpp"> 99<para><para>Andrey Semashev </para> 100 101<para>09.03.2009</para> 102 103This header contains a logging record class definition. </para><namespace name="boost"> 104<namespace name="log"> 105<class name="record"><purpose>Logging record class. </purpose><description><para>The logging record encapsulates all information related to a single logging statement, in particular, attribute values view and the log message string. The record can be updated before pushing for further processing to the logging core. </para></description><method-group name="public member functions"> 106<method name="attribute_values" cv="noexcept"><type>attribute_value_set &</type><description><para> 107 108</para></description><requires><para><computeroutput>!!*this</computeroutput> </para> 109</requires><returns><para>A reference to the set of attribute values attached to this record</para> 110</returns></method> 111<method name="attribute_values" cv="const noexcept"><type>attribute_value_set const &</type><description><para> 112 113</para></description><requires><para><computeroutput>!!*this</computeroutput> </para> 114</requires><returns><para>A reference to the set of attribute values attached to this record</para> 115</returns></method> 116<method name="conversion-operator" cv="const noexcept" specifiers="explicit"><type>bool</type><description><para>Conversion to an unspecified boolean type</para><para> 117</para></description><returns><para><computeroutput>true</computeroutput>, if the <computeroutput>*this</computeroutput> identifies a log record, <computeroutput>false</computeroutput>, if the <computeroutput>*this</computeroutput> is not valid </para> 118</returns></method> 119<method name="operator!" cv="const noexcept"><type>bool</type><description><para>Inverted conversion to an unspecified boolean type</para><para> 120</para></description><returns><para><computeroutput>false</computeroutput>, if the <computeroutput>*this</computeroutput> identifies a log record, <computeroutput>true</computeroutput>, if the <computeroutput>*this</computeroutput> is not valid </para> 121</returns></method> 122<method name="swap" cv="noexcept"><type>void</type><parameter name="that"><paramtype><classname>record</classname> &</paramtype><description><para>Another record to swap with <emphasis role="bold">Throws:</emphasis> Nothing </para></description></parameter><description><para>Swaps two handles</para><para> 123</para></description></method> 124<method name="reset" cv="noexcept"><type>void</type><description><para>Resets the log record handle. If there are no other handles left, the log record is closed and all resources referenced by the record are released.</para><para> 125</para></description><postconditions><para><computeroutput>!*this == true</computeroutput> </para> 126</postconditions></method> 127<method name="operator[]" cv="const"><type>attribute_value_set::mapped_type</type><parameter name="name"><paramtype>attribute_value_set::key_type</paramtype><description><para>Attribute name. </para></description></parameter><description><para>Attribute value lookup.</para><para> 128 129</para></description><returns><para>An <computeroutput>attribute_value</computeroutput>, non-empty if it is found, empty otherwise. </para> 130</returns></method> 131<method name="operator[]" cv="const"><type>result_of::extract< typename expressions::attribute_keyword< DescriptorT, ActorT >::value_type, DescriptorT >::type</type><template> 132 <template-type-parameter name="DescriptorT"/> 133 <template-nontype-parameter name="ActorT"><type>template< typename > class</type></template-nontype-parameter> 134 </template><parameter name="keyword"><paramtype>expressions::attribute_keyword< DescriptorT, ActorT > const &</paramtype><description><para>Attribute keyword. </para></description></parameter><description><para>Attribute value lookup.</para><para> 135 136</para></description><returns><para>A <computeroutput>value_ref</computeroutput> with extracted attribute value if it is found, empty <computeroutput>value_ref</computeroutput> otherwise. </para> 137</returns></method> 138<method name="lock"><type><classname>record_view</classname></type><description><para>The function ensures that the log record does not depend on any thread-specific data. Then the record contents are used to construct a <computeroutput><classname alt="boost::log::record_view">record_view</classname></computeroutput> which is returned from the function. The record is no longer valid after the call.</para><para> 139 140 141</para></description><requires><para><computeroutput>!!*this</computeroutput> </para> 142</requires><postconditions><para><computeroutput>!*this</computeroutput> </para> 143</postconditions><returns><para>The record view that contains all attribute values from the original record. </para> 144</returns></method> 145</method-group> 146<constructor cv="noexcept"><description><para>Default constructor. Creates an empty record that is equivalent to the invalid record handle.</para><para> 147</para></description><postconditions><para><computeroutput>!*this == true</computeroutput> </para> 148</postconditions></constructor> 149<constructor cv="noexcept"><parameter name="that"><paramtype><classname>record</classname> &&</paramtype></parameter><description><para>Move constructor. Source record contents unspecified after the operation. </para></description></constructor> 150<destructor><description><para>Destructor. Destroys the record, releases any sinks and attribute values that were involved in processing this record. </para></description></destructor> 151<copy-assignment cv="noexcept"><type><classname>record</classname> &</type><parameter name="that"><paramtype><classname>record</classname> &&</paramtype></parameter><description><para>Move assignment. Source record contents unspecified after the operation. </para></description></copy-assignment> 152</class> 153<function name="swap"><type>void</type><parameter name="left"><paramtype><classname>record</classname> &</paramtype></parameter><parameter name="right"><paramtype><classname>record</classname> &</paramtype></parameter><description><para>A free-standing swap function overload for <computeroutput>record</computeroutput> </para></description></function> 154</namespace> 155</namespace> 156</header> 157<header name="boost/log/core/record_view.hpp"> 158<para><para>Andrey Semashev </para> 159 160<para>09.03.2009</para> 161 162This header contains a logging record view class definition. </para><namespace name="boost"> 163<namespace name="log"> 164<class name="record_view"><purpose>Logging record view class. </purpose><description><para>The logging record encapsulates all information related to a single logging statement, in particular, attribute values view and the log message string. The view is immutable, it is implemented as a wrapper around a reference-counted implementation. </para></description><method-group name="public member functions"> 165<method name="attribute_values" cv="const noexcept"><type>attribute_value_set const &</type><description><para> 166 167</para></description><requires><para><computeroutput>!!*this</computeroutput> </para> 168</requires><returns><para>A reference to the set of attribute values attached to this record</para> 169</returns></method> 170<method name="operator==" cv="const noexcept"><type>bool</type><parameter name="that"><paramtype><classname>record_view</classname> const &</paramtype><description><para>Comparand </para></description></parameter><description><para>Equality comparison</para><para> 171 172</para></description><returns><para><computeroutput>true</computeroutput> if both <computeroutput>*this</computeroutput> and <emphasis>that</emphasis> identify the same log record or both do not identify any record, <computeroutput>false</computeroutput> otherwise. </para> 173</returns></method> 174<method name="operator!=" cv="const noexcept"><type>bool</type><parameter name="that"><paramtype><classname>record_view</classname> const &</paramtype><description><para>Comparand </para></description></parameter><description><para>Inequality comparison</para><para> 175 176</para></description><returns><para><computeroutput>!(*this == that)</computeroutput> </para> 177</returns></method> 178<method name="conversion-operator" cv="const noexcept" specifiers="explicit"><type>bool</type><description><para>Conversion to an unspecified boolean type</para><para> 179</para></description><returns><para><computeroutput>true</computeroutput>, if the <computeroutput>*this</computeroutput> identifies a log record, <computeroutput>false</computeroutput>, if the <computeroutput>*this</computeroutput> is not valid </para> 180</returns></method> 181<method name="operator!" cv="const noexcept"><type>bool</type><description><para>Inverted conversion to an unspecified boolean type</para><para> 182</para></description><returns><para><computeroutput>false</computeroutput>, if the <computeroutput>*this</computeroutput> identifies a log record, <computeroutput>true</computeroutput>, if the <computeroutput>*this</computeroutput> is not valid </para> 183</returns></method> 184<method name="swap" cv="noexcept"><type>void</type><parameter name="that"><paramtype><classname>record_view</classname> &</paramtype><description><para>Another record to swap with <emphasis role="bold">Throws:</emphasis> Nothing </para></description></parameter><description><para>Swaps two handles</para><para> 185</para></description></method> 186<method name="reset" cv="noexcept"><type>void</type><description><para>Resets the log record handle. If there are no other handles left, the log record is closed and all resources referenced by the record are released.</para><para> 187</para></description><postconditions><para><computeroutput>!*this == true</computeroutput> </para> 188</postconditions></method> 189<method name="operator[]" cv="const"><type>attribute_value_set::mapped_type</type><parameter name="name"><paramtype>attribute_value_set::key_type</paramtype><description><para>Attribute name. </para></description></parameter><description><para>Attribute value lookup.</para><para> 190 191</para></description><returns><para>An <computeroutput>attribute_value</computeroutput>, non-empty if it is found, empty otherwise. </para> 192</returns></method> 193<method name="operator[]" cv="const"><type>result_of::extract< typename expressions::attribute_keyword< DescriptorT, ActorT >::value_type, DescriptorT >::type</type><template> 194 <template-type-parameter name="DescriptorT"/> 195 <template-nontype-parameter name="ActorT"><type>template< typename > class</type></template-nontype-parameter> 196 </template><parameter name="keyword"><paramtype>expressions::attribute_keyword< DescriptorT, ActorT > const &</paramtype><description><para>Attribute keyword. </para></description></parameter><description><para>Attribute value lookup.</para><para> 197 198</para></description><returns><para>A <computeroutput>value_ref</computeroutput> with extracted attribute value if it is found, empty <computeroutput>value_ref</computeroutput> otherwise. </para> 199</returns></method> 200</method-group> 201<constructor><description><para>Default constructor. Creates an empty record view that is equivalent to the invalid record handle.</para><para> 202</para></description><postconditions><para><computeroutput>!*this == true</computeroutput> </para> 203</postconditions></constructor> 204<constructor cv="noexcept"><parameter name="that"><paramtype><classname>record_view</classname> const &</paramtype></parameter><description><para>Copy constructor </para></description></constructor> 205<constructor cv="noexcept"><parameter name="that"><paramtype><classname>record_view</classname> &&</paramtype></parameter><description><para>Move constructor. Source record contents unspecified after the operation. </para></description></constructor> 206<destructor><description><para>Destructor. Destroys the record, releases any sinks and attribute values that were involved in processing this record. </para></description></destructor> 207<copy-assignment cv="noexcept"><type><classname>record_view</classname> &</type><parameter name="that"><paramtype><classname>record_view</classname> const &</paramtype></parameter><description><para>Copy assignment </para></description></copy-assignment> 208<copy-assignment cv="noexcept"><type><classname>record_view</classname> &</type><parameter name="that"><paramtype><classname>record_view</classname> &&</paramtype></parameter><description><para>Move assignment. Source record contents unspecified after the operation. </para></description></copy-assignment> 209</class><function name="swap"><type>void</type><parameter name="left"><paramtype><classname>record_view</classname> &</paramtype></parameter><parameter name="right"><paramtype><classname>record_view</classname> &</paramtype></parameter><description><para>A free-standing swap function overload for <computeroutput><classname alt="boost::log::record_view">record_view</classname></computeroutput> </para></description></function> 210 211</namespace> 212</namespace> 213</header> 214</library-reference>