core_reference.xml 28 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  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. <para>19.04.2007</para>
  5. This header contains logging core class definition. </para><namespace name="boost">
  6. <namespace name="log">
  7. <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>
  8. <method-group name="public member functions">
  9. <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>
  10. </para></description><returns><para>The previous value of enabled/disabled logging flag </para>
  11. </returns></method>
  12. <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>
  13. <method name="set_filter"><type>void</type><parameter name="filter"><paramtype>filter const &amp;</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>
  14. </para></description></method>
  15. <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>
  16. <method name="add_sink"><type>void</type><parameter name="s"><paramtype>shared_ptr&lt; sinks::sink &gt; const &amp;</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>
  17. </para></description></method>
  18. <method name="remove_sink"><type>void</type><parameter name="s"><paramtype>shared_ptr&lt; sinks::sink &gt; const &amp;</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>
  19. </para></description></method>
  20. <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>
  21. <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>
  22. </note>
  23. </para></description></method>
  24. <method name="add_global_attribute"><type>std::pair&lt; attribute_set::iterator, bool &gt;</type><parameter name="name"><paramtype>attribute_name const &amp;</paramtype><description><para>The attribute name. </para></description></parameter><parameter name="attr"><paramtype>attribute const &amp;</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>
  25. </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>
  26. </returns></method>
  27. <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>
  28. </para></description><requires><para>The attribute was added with the <computeroutput>add_global_attribute</computeroutput> call. </para>
  29. </requires><postconditions><para>The attribute is no longer registered as a global attribute. The iterator is invalidated after removal.</para>
  30. </postconditions></method>
  31. <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>
  32. <method name="set_global_attributes"><type>void</type><parameter name="attrs"><paramtype>attribute_set const &amp;</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>
  33. </note>
  34. </para></description></method>
  35. <method name="add_thread_attribute"><type>std::pair&lt; attribute_set::iterator, bool &gt;</type><parameter name="name"><paramtype>attribute_name const &amp;</paramtype><description><para>The attribute name. </para></description></parameter><parameter name="attr"><paramtype>attribute const &amp;</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>
  36. </note>
  37. </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>
  38. </returns></method>
  39. <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>
  40. </para></description><requires><para>The attribute was added with the <computeroutput>add_thread_attribute</computeroutput> call. </para>
  41. </requires><postconditions><para>The attribute is no longer registered as a thread-specific attribute. The iterator is invalidated after removal.</para>
  42. </postconditions></method>
  43. <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>
  44. <method name="set_thread_attributes"><type>void</type><parameter name="attrs"><paramtype>attribute_set const &amp;</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>
  45. </note>
  46. </para></description></method>
  47. <method name="set_exception_handler"><type>void</type><parameter name="handler"><paramtype>exception_handler_type const &amp;</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>
  48. </para>
  49. <note><para>The exception handler can be invoked in several threads concurrently. Thread interruptions are not affected by exception handlers. </para>
  50. </note>
  51. </para></description></method>
  52. <method name="open_record"><type><classname>record</classname></type><parameter name="source_attributes"><paramtype>attribute_set const &amp;</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>
  53. <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>
  54. </returns></method>
  55. <method name="open_record"><type><classname>record</classname></type><parameter name="source_attributes"><paramtype>attribute_value_set const &amp;</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>
  56. <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>
  57. </returns></method>
  58. <method name="open_record"><type><classname>record</classname></type><parameter name="source_attributes"><paramtype>attribute_value_set &amp;&amp;</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>
  59. <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>
  60. </returns></method>
  61. <method name="push_record"><type>void</type><parameter name="rec"><paramtype><classname>record</classname> &amp;&amp;</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>
  62. <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>
  63. </requires><postconditions><para><computeroutput>!rec == true</computeroutput> </para>
  64. </postconditions></method>
  65. </method-group>
  66. <destructor><description><para>Destructor. Destroys the core, releases any sinks and attributes that were registered. </para></description></destructor>
  67. <constructor cv="= delete"><parameter name=""><paramtype><classname>core</classname> const &amp;</paramtype></parameter></constructor>
  68. <copy-assignment cv="= delete"><type><classname>core</classname> &amp;</type><parameter name=""><paramtype><classname>core</classname> const &amp;</paramtype></parameter></copy-assignment>
  69. <method-group name="public static functions">
  70. <method name="get" specifiers="static"><type>core_ptr</type><description><para>
  71. </para></description><returns><para>The method returns a pointer to the logging core singleton instance. </para>
  72. </returns></method>
  73. </method-group>
  74. </class><typedef name="core_ptr"><type>shared_ptr&lt; <classname>core</classname> &gt;</type></typedef>
  75. </namespace>
  76. </namespace>
  77. </header>
  78. <header name="boost/log/core/record.hpp">
  79. <para><para>Andrey Semashev </para>
  80. <para>09.03.2009</para>
  81. This header contains a logging record class definition. </para><namespace name="boost">
  82. <namespace name="log">
  83. <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">
  84. <method name="attribute_values" cv="noexcept"><type>attribute_value_set &amp;</type><description><para>
  85. </para></description><requires><para><computeroutput>!!*this</computeroutput> </para>
  86. </requires><returns><para>A reference to the set of attribute values attached to this record</para>
  87. </returns></method>
  88. <method name="attribute_values" cv="const noexcept"><type>attribute_value_set const &amp;</type><description><para>
  89. </para></description><requires><para><computeroutput>!!*this</computeroutput> </para>
  90. </requires><returns><para>A reference to the set of attribute values attached to this record</para>
  91. </returns></method>
  92. <method name="conversion-operator" cv="const noexcept" specifiers="explicit"><type>bool</type><description><para>Conversion to an unspecified boolean type</para><para>
  93. </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>
  94. </returns></method>
  95. <method name="operator!" cv="const noexcept"><type>bool</type><description><para>Inverted conversion to an unspecified boolean type</para><para>
  96. </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>
  97. </returns></method>
  98. <method name="swap" cv="noexcept"><type>void</type><parameter name="that"><paramtype><classname>record</classname> &amp;</paramtype><description><para>Another record to swap with <emphasis role="bold">Throws:</emphasis> Nothing </para></description></parameter><description><para>Swaps two handles</para><para>
  99. </para></description></method>
  100. <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>
  101. </para></description><postconditions><para><computeroutput>!*this == true</computeroutput> </para>
  102. </postconditions></method>
  103. <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>
  104. </para></description><returns><para>An <computeroutput>attribute_value</computeroutput>, non-empty if it is found, empty otherwise. </para>
  105. </returns></method>
  106. <method name="operator[]" cv="const"><type>result_of::extract&lt; typename expressions::attribute_keyword&lt; DescriptorT, ActorT &gt;::value_type, DescriptorT &gt;::type</type><template>
  107. <template-type-parameter name="DescriptorT"/>
  108. <template-nontype-parameter name="ActorT"><type>template&lt; typename &gt; class</type></template-nontype-parameter>
  109. </template><parameter name="keyword"><paramtype>expressions::attribute_keyword&lt; DescriptorT, ActorT &gt; const &amp;</paramtype><description><para>Attribute keyword. </para></description></parameter><description><para>Attribute value lookup.</para><para>
  110. </para></description><returns><para>A <computeroutput>value_ref</computeroutput> with extracted attribute value if it is found, empty <computeroutput>value_ref</computeroutput> otherwise. </para>
  111. </returns></method>
  112. <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>
  113. </para></description><requires><para><computeroutput>!!*this</computeroutput> </para>
  114. </requires><postconditions><para><computeroutput>!*this</computeroutput> </para>
  115. </postconditions><returns><para>The record view that contains all attribute values from the original record. </para>
  116. </returns></method>
  117. </method-group>
  118. <constructor cv="noexcept"><description><para>Default constructor. Creates an empty record that is equivalent to the invalid record handle.</para><para>
  119. </para></description><postconditions><para><computeroutput>!*this == true</computeroutput> </para>
  120. </postconditions></constructor>
  121. <constructor cv="noexcept"><parameter name="that"><paramtype><classname>record</classname> &amp;&amp;</paramtype></parameter><description><para>Move constructor. Source record contents unspecified after the operation. </para></description></constructor>
  122. <destructor><description><para>Destructor. Destroys the record, releases any sinks and attribute values that were involved in processing this record. </para></description></destructor>
  123. <copy-assignment cv="noexcept"><type><classname>record</classname> &amp;</type><parameter name="that"><paramtype><classname>record</classname> &amp;&amp;</paramtype></parameter><description><para>Move assignment. Source record contents unspecified after the operation. </para></description></copy-assignment>
  124. </class>
  125. <function name="swap"><type>void</type><parameter name="left"><paramtype><classname>record</classname> &amp;</paramtype></parameter><parameter name="right"><paramtype><classname>record</classname> &amp;</paramtype></parameter><description><para>A free-standing swap function overload for <computeroutput>record</computeroutput> </para></description></function>
  126. </namespace>
  127. </namespace>
  128. </header>
  129. <header name="boost/log/core/record_view.hpp">
  130. <para><para>Andrey Semashev </para>
  131. <para>09.03.2009</para>
  132. This header contains a logging record view class definition. </para><namespace name="boost">
  133. <namespace name="log">
  134. <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">
  135. <method name="attribute_values" cv="const noexcept"><type>attribute_value_set const &amp;</type><description><para>
  136. </para></description><requires><para><computeroutput>!!*this</computeroutput> </para>
  137. </requires><returns><para>A reference to the set of attribute values attached to this record</para>
  138. </returns></method>
  139. <method name="operator==" cv="const noexcept"><type>bool</type><parameter name="that"><paramtype><classname>record_view</classname> const &amp;</paramtype><description><para>Comparand </para></description></parameter><description><para>Equality comparison</para><para>
  140. </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>
  141. </returns></method>
  142. <method name="operator!=" cv="const noexcept"><type>bool</type><parameter name="that"><paramtype><classname>record_view</classname> const &amp;</paramtype><description><para>Comparand </para></description></parameter><description><para>Inequality comparison</para><para>
  143. </para></description><returns><para><computeroutput>!(*this == that)</computeroutput> </para>
  144. </returns></method>
  145. <method name="conversion-operator" cv="const noexcept" specifiers="explicit"><type>bool</type><description><para>Conversion to an unspecified boolean type</para><para>
  146. </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>
  147. </returns></method>
  148. <method name="operator!" cv="const noexcept"><type>bool</type><description><para>Inverted conversion to an unspecified boolean type</para><para>
  149. </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>
  150. </returns></method>
  151. <method name="swap" cv="noexcept"><type>void</type><parameter name="that"><paramtype><classname>record_view</classname> &amp;</paramtype><description><para>Another record to swap with <emphasis role="bold">Throws:</emphasis> Nothing </para></description></parameter><description><para>Swaps two handles</para><para>
  152. </para></description></method>
  153. <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>
  154. </para></description><postconditions><para><computeroutput>!*this == true</computeroutput> </para>
  155. </postconditions></method>
  156. <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>
  157. </para></description><returns><para>An <computeroutput>attribute_value</computeroutput>, non-empty if it is found, empty otherwise. </para>
  158. </returns></method>
  159. <method name="operator[]" cv="const"><type>result_of::extract&lt; typename expressions::attribute_keyword&lt; DescriptorT, ActorT &gt;::value_type, DescriptorT &gt;::type</type><template>
  160. <template-type-parameter name="DescriptorT"/>
  161. <template-nontype-parameter name="ActorT"><type>template&lt; typename &gt; class</type></template-nontype-parameter>
  162. </template><parameter name="keyword"><paramtype>expressions::attribute_keyword&lt; DescriptorT, ActorT &gt; const &amp;</paramtype><description><para>Attribute keyword. </para></description></parameter><description><para>Attribute value lookup.</para><para>
  163. </para></description><returns><para>A <computeroutput>value_ref</computeroutput> with extracted attribute value if it is found, empty <computeroutput>value_ref</computeroutput> otherwise. </para>
  164. </returns></method>
  165. </method-group>
  166. <constructor><description><para>Default constructor. Creates an empty record view that is equivalent to the invalid record handle.</para><para>
  167. </para></description><postconditions><para><computeroutput>!*this == true</computeroutput> </para>
  168. </postconditions></constructor>
  169. <constructor cv="noexcept"><parameter name="that"><paramtype><classname>record_view</classname> const &amp;</paramtype></parameter><description><para>Copy constructor </para></description></constructor>
  170. <constructor cv="noexcept"><parameter name="that"><paramtype><classname>record_view</classname> &amp;&amp;</paramtype></parameter><description><para>Move constructor. Source record contents unspecified after the operation. </para></description></constructor>
  171. <destructor><description><para>Destructor. Destroys the record, releases any sinks and attribute values that were involved in processing this record. </para></description></destructor>
  172. <copy-assignment cv="noexcept"><type><classname>record_view</classname> &amp;</type><parameter name="that"><paramtype><classname>record_view</classname> const &amp;</paramtype></parameter><description><para>Copy assignment </para></description></copy-assignment>
  173. <copy-assignment cv="noexcept"><type><classname>record_view</classname> &amp;</type><parameter name="that"><paramtype><classname>record_view</classname> &amp;&amp;</paramtype></parameter><description><para>Move assignment. Source record contents unspecified after the operation. </para></description></copy-assignment>
  174. </class><function name="swap"><type>void</type><parameter name="left"><paramtype><classname>record_view</classname> &amp;</paramtype></parameter><parameter name="right"><paramtype><classname>record_view</classname> &amp;</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>
  175. </namespace>
  176. </namespace>
  177. </header>
  178. </library-reference>