Ticket #8585: fix_log_typo.patch
File fix_log_typo.patch, 88.7 KB (added by , 9 years ago) |
---|
-
boost/log/expressions/keyword.hpp
239 239 /*! 240 240 * \brief The macro declares an attribute keyword 241 241 * 242 * The macro provides definitions similar to \c BOOST_LOG_ATTRIBUTE_KEYWORD_TYPE and addi dionally242 * The macro provides definitions similar to \c BOOST_LOG_ATTRIBUTE_KEYWORD_TYPE and additionally 243 243 * defines the keyword object. 244 244 * 245 245 * \param keyword_ Keyword name -
boost/log/sources/basic_logger.hpp
306 306 * The user's logger class is expected to derive from the composite logger class, instantiated with 307 307 * the character type, the user's logger class, the threading model and the list of the required features. 308 308 * The former three parameters are passed to the \c basic_logger class template. The feature list 309 * must be a MPL type sequence, where each element is anunary MPL metafunction class, that upon309 * must be an MPL type sequence, where each element is a unary MPL metafunction class, that upon 310 310 * applying on its argument results in a logging feature class that derives from the argument. 311 311 * Every logger feature provided by the library can participate in the feature list. 312 312 */ -
boost/log/attributes/constant.hpp
38 38 /*! 39 39 * \brief A class of an attribute that holds a single constant value 40 40 * 41 * The constant is a simpl iest and one of the most frequently used types of attributes.41 * The constant is a simplest and one of the most frequently used types of attributes. 42 42 * It stores a constant value, which it eventually returns as its value each time 43 43 * requested. 44 44 */ -
boost/log/attributes/clock.hpp
41 41 * The time traits provided by the library use \c boost::posix_time::ptime as the time type. 42 42 * 43 43 * Time traits also determine the way time is acquired. There are two types of time traits 44 * provided by th library: \c utc_time_traits and \c local_time_traits. The first returns UTC time,44 * provided by the library: \c utc_time_traits and \c local_time_traits. The first returns UTC time, 45 45 * the second returns local time. 46 46 */ 47 47 template< typename TimeTraitsT > -
boost/log/attributes/attribute_value.hpp
39 39 * \brief An attribute value class 40 40 * 41 41 * An attribute value is an object that contains a piece of data that represents an attribute state 42 * at the point of the value acquisi on. All major operations with log records, such as filtering and42 * at the point of the value acquisition. All major operations with log records, such as filtering and 43 43 * formatting, involve attribute values contained in a single view. Most likely an attribute value is 44 44 * implemented as a simple holder of some typed value. This holder implements the 45 45 * \c attribute_value::implementation interface and acts as a pimpl for the \c attribute_value … … 213 213 214 214 /*! 215 215 * The method attempts to extract the stored value, assuming the value has the specified type. 216 * One can specify either a single type or a MPL type sequence, in which case the stored value216 * One can specify either a single type or an MPL type sequence, in which case the stored value 217 217 * is checked against every type in the sequence. 218 218 * 219 219 * \note Include <tt>value_extraction.hpp</tt> prior to using this method. … … 227 227 228 228 /*! 229 229 * The method attempts to extract the stored value, assuming the value has the specified type. 230 * One can specify either a single type or a MPL type sequence, in which case the stored value230 * One can specify either a single type or an MPL type sequence, in which case the stored value 231 231 * is checked against every type in the sequence. 232 232 * 233 233 * \note Include <tt>value_extraction.hpp</tt> prior to using this method. … … 241 241 242 242 /*! 243 243 * The method attempts to extract the stored value, assuming the value has the specified type. 244 * One can specify either a single type or a MPL type sequence, in which case the stored value244 * One can specify either a single type or an MPL type sequence, in which case the stored value 245 245 * is checked against every type in the sequence. If extraction fails, the default value is returned. 246 246 * 247 247 * \note Include <tt>value_extraction.hpp</tt> prior to using this method. … … 257 257 258 258 /*! 259 259 * The method attempts to extract the stored value, assuming the value has the specified type. 260 * One can specify either a single type or a MPL type sequence, in which case the stored value260 * One can specify either a single type or an MPL type sequence, in which case the stored value 261 261 * is checked against every type in the sequence. If extraction fails, the default value is returned. 262 262 * 263 263 * \note Include <tt>value_extraction.hpp</tt> prior to using this method. … … 274 274 #if defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) 275 275 /*! 276 276 * The method attempts to extract the stored value, assuming the value has the specified type. 277 * One can specify either a single type or a MPL type sequence, in which case the stored value277 * One can specify either a single type or an MPL type sequence, in which case the stored value 278 278 * is checked against every type in the sequence. 279 279 * 280 280 * \note Include <tt>value_extraction.hpp</tt> prior to using this method. … … 288 288 289 289 /*! 290 290 * The method attempts to extract the stored value, assuming the value has the specified type. 291 * One can specify either a single type or a MPL type sequence, in which case the stored value291 * One can specify either a single type or an MPL type sequence, in which case the stored value 292 292 * is checked against every type in the sequence. 293 293 * 294 294 * \note Include <tt>value_extraction.hpp</tt> prior to using this method. … … 302 302 303 303 /*! 304 304 * The method attempts to extract the stored value, assuming the value has the specified type. 305 * One can specify either a single type or a MPL type sequence, in which case the stored value305 * One can specify either a single type or an MPL type sequence, in which case the stored value 306 306 * is checked against every type in the sequence. If extraction fails, the default value is returned. 307 307 * 308 308 * \note Include <tt>value_extraction.hpp</tt> prior to using this method. … … 318 318 319 319 /*! 320 320 * The method attempts to extract the stored value, assuming the value has the specified type. 321 * One can specify either a single type or a MPL type sequence, in which case the stored value321 * One can specify either a single type or an MPL type sequence, in which case the stored value 322 322 * is checked against every type in the sequence. If extraction fails, the default value is returned. 323 323 * 324 324 * \note Include <tt>value_extraction.hpp</tt> prior to using this method. … … 338 338 /*! 339 339 * The method attempts to extract the stored value, assuming the value has the specified type, 340 340 * and pass it to the \a visitor function object. 341 * One can specify either a single type or a MPL type sequence, in which case the stored value341 * One can specify either a single type or an MPL type sequence, in which case the stored value 342 342 * is checked against every type in the sequence. 343 343 * 344 344 * \note Include <tt>value_visitation.hpp</tt> prior to using this method. -
boost/log/attributes/mutable_constant.hpp
45 45 * The mutable_constant attribute stores a single value of type, specified as the first template argument. 46 46 * This value is returned on each attribute value acquisition. 47 47 * 48 * The attribute also allows to modify the stored value, even if the att ibute is registered in an attribute set.48 * The attribute also allows to modify the stored value, even if the attribute is registered in an attribute set. 49 49 * In order to ensure thread safety of such modifications the \c mutable_constant class is also parametrized 50 50 * with three additional template arguments: mutex type, scoped write and scoped read lock types. If not specified, 51 51 * the lock types are automatically deduced based on the mutex type. -
boost/log/attributes/attribute.hpp
50 50 * Every attribute is represented with a factory that is basically an attribute value generator. 51 51 * The sole purpose of an attribute is to return an actual value when requested. A simplest attribute 52 52 * can always return the same value that it stores internally, but more complex ones can 53 * perform a consid irable amount of work to return a value, and the returned values may differ53 * perform a considerable amount of work to return a value, and the returned values may differ 54 54 * each time requested. 55 55 * 56 56 * A word about thread safety. An attribute should be prepared to be requested a value from -
boost/log/attributes/attribute_name.hpp
39 39 * lighter in terms of memory footprint and operations complexity. This is done 40 40 * transparently by this class, on object construction. Passing objects of this class 41 41 * to other library methods, such as attribute lookup functions, will not require 42 * this t hanslation and/or string copying and thus will result in a more efficient code.42 * this translation and/or string copying and thus will result in a more efficient code. 43 43 */ 44 44 class attribute_name 45 45 { -
boost/log/attributes/value_extraction.hpp
54 54 * \brief A metafunction that allows to acquire the result of the value extraction 55 55 * 56 56 * The metafunction results in a type that is in form of <tt>T const&</tt>, if \c T is 57 * not a MPL type sequence and <tt>DefaultT</tt> is the same as <tt>T</tt>,57 * not an MPL type sequence and <tt>DefaultT</tt> is the same as <tt>T</tt>, 58 58 * or <tt>value_ref< TypesT, TagT ></tt> otherwise, with 59 59 * \c TypesT being a type sequence comprising the types from sequence \c T and \c DefaultT, 60 60 * if it is not present in \c T already. … … 87 87 * \brief A metafunction that allows to acquire the result of the value extraction 88 88 * 89 89 * The metafunction results in a type that is in form of <tt>T const&</tt>, if \c T is 90 * not a MPL type sequence, or <tt>value_ref< T, TagT ></tt> otherwise. In the latter90 * not an MPL type sequence, or <tt>value_ref< T, TagT ></tt> otherwise. In the latter 91 91 * case the value reference shall never be empty. 92 92 */ 93 93 template< typename T, typename TagT > … … 414 414 * The function extracts an attribute value from the view. The user has to explicitly specify the 415 415 * type or set of possible types of the attribute value to be extracted. 416 416 * 417 * \note Caution must be ex cercised if the default value is a temporary object. Because the function returns418 * a reference, if the temporary object is destro ued, the reference may become dangling.417 * \note Caution must be exercised if the default value is a temporary object. Because the function returns 418 * a reference, if the temporary object is destroyed, the reference may become dangling. 419 419 * 420 420 * \param name The name of the attribute value to extract. 421 421 * \param attrs A set of attribute values in which to look for the specified attribute value. … … 435 435 * The function extracts an attribute value from the view. The user has to explicitly specify the 436 436 * type or set of possible types of the attribute value to be visited. 437 437 * 438 * \note Caution must be ex cercised if the default value is a temporary object. Because the function returns439 * a reference, if the temporary object is destro ued, the reference may become dangling.438 * \note Caution must be exercised if the default value is a temporary object. Because the function returns 439 * a reference, if the temporary object is destroyed, the reference may become dangling. 440 440 * 441 441 * \param name The name of the attribute value to extract. 442 442 * \param rec A log record. The attribute value will be sought among those associated with the record. … … 456 456 * The function extracts an attribute value from the view. The user has to explicitly specify the 457 457 * type or set of possible types of the attribute value to be visited. 458 458 * 459 * \note Caution must be ex cercised if the default value is a temporary object. Because the function returns460 * a reference, if the temporary object is destro ued, the reference may become dangling.459 * \note Caution must be exercised if the default value is a temporary object. Because the function returns 460 * a reference, if the temporary object is destroyed, the reference may become dangling. 461 461 * 462 462 * \param name The name of the attribute value to extract. 463 463 * \param rec A log record view. The attribute value will be sought among those associated with the record. … … 477 477 * The function extracts an attribute value from the view. The user has to explicitly specify the 478 478 * type or set of possible types of the attribute value to be visited. 479 479 * 480 * \note Caution must be ex cercised if the default value is a temporary object. Because the function returns481 * a reference, if the temporary object is destro ued, the reference may become dangling.480 * \note Caution must be exercised if the default value is a temporary object. Because the function returns 481 * a reference, if the temporary object is destroyed, the reference may become dangling. 482 482 * 483 483 * \param value Attribute value. 484 484 * \param def_val The default value … … 690 690 * The function extracts an attribute value from the view. The user has to explicitly specify the 691 691 * type or set of possible types of the attribute value to be extracted. 692 692 * 693 * \note Caution must be ex cercised if the default value is a temporary object. Because the function returns694 * a reference, if the temporary object is destro ued, the reference may become dangling.693 * \note Caution must be exercised if the default value is a temporary object. Because the function returns 694 * a reference, if the temporary object is destroyed, the reference may become dangling. 695 695 * 696 696 * \param keyword The keyword of the attribute value to extract. 697 697 * \param attrs A set of attribute values in which to look for the specified attribute value. … … 711 711 * The function extracts an attribute value from the view. The user has to explicitly specify the 712 712 * type or set of possible types of the attribute value to be visited. 713 713 * 714 * \note Caution must be ex cercised if the default value is a temporary object. Because the function returns715 * a reference, if the temporary object is destro ued, the reference may become dangling.714 * \note Caution must be exercised if the default value is a temporary object. Because the function returns 715 * a reference, if the temporary object is destroyed, the reference may become dangling. 716 716 * 717 717 * \param keyword The keyword of the attribute value to extract. 718 718 * \param rec A log record. The attribute value will be sought among those associated with the record. … … 732 732 * The function extracts an attribute value from the view. The user has to explicitly specify the 733 733 * type or set of possible types of the attribute value to be visited. 734 734 * 735 * \note Caution must be ex cercised if the default value is a temporary object. Because the function returns736 * a reference, if the temporary object is destro ued, the reference may become dangling.735 * \note Caution must be exercised if the default value is a temporary object. Because the function returns 736 * a reference, if the temporary object is destroyed, the reference may become dangling. 737 737 * 738 738 * \param keyword The keyword of the attribute value to extract. 739 739 * \param rec A log record view. The attribute value will be sought among those associated with the record. -
boost/log/attributes/timer.hpp
34 34 /*! 35 35 * \brief A class of an attribute that makes an attribute value of the time interval since construction 36 36 * 37 * The timer attribute calculates the time passed since its construction and returns it on value acquisi on.37 * The timer attribute calculates the time passed since its construction and returns it on value acquisition. 38 38 * The attribute value type is <tt>boost::posix_time::time_duration</tt>. 39 39 * 40 40 * On Windows platform there are two implementations of the attribute. The default one is more precise but … … 42 42 * to calculate elapsed time. 43 43 * 44 44 * There are known problems with these functions when used with some CPUs, notably AMD Athlon with 45 * Cool'n'Quiet technology enabled. See the following links for formore information and possible resolutions:45 * Cool'n'Quiet technology enabled. See the following links for more information and possible resolutions: 46 46 * 47 47 * http://support.microsoft.com/?scid=kb;en-us;895980 48 48 * http://support.microsoft.com/?id=896256 -
boost/log/attributes/function.hpp
77 77 78 78 public: 79 79 /*! 80 * Constructor with the stored delegate i mitialization80 * Constructor with the stored delegate initialization 81 81 */ 82 82 explicit impl_template(T const& fun) : m_Functor(fun) {} 83 83 -
boost/log/attributes/value_visitation.hpp
53 53 { 54 54 ok, //!< The attribute value has been visited successfully 55 55 value_not_found, //!< The attribute value is not present in the view 56 value_has_invalid_type //!< The attribute value is present in the v ew, but has an unexpected type56 value_has_invalid_type //!< The attribute value is present in the view, but has an unexpected type 57 57 }; 58 58 59 59 private: … … 90 90 * 91 91 * Attribute value invoker is a functional object that attempts to find and extract the stored 92 92 * attribute value from the attribute value view or a log record. The extracted value is passed to 93 * a nunary function object (the visitor) provided by user.93 * a unary function object (the visitor) provided by user. 94 94 * 95 95 * The invoker can be specialized on one or several attribute value types that should be 96 96 * specified in the second template argument. -
boost/log/sinks/event_log_backend.hpp
304 304 private: 305 305 //! The mapper that will extract the event identifier 306 306 event_id_mapper_type m_EventIDMapper; 307 //! The map of event identifiers and andtheir insertion composers307 //! The map of event identifiers and their insertion composers 308 308 event_map m_EventMap; 309 309 310 310 public: -
boost/log/sinks/unlocked_frontend.hpp
100 100 /*! 101 101 * Locking accessor to the attached backend. 102 102 * 103 * \note Does not do any actual locking, provided only for int arface consistency103 * \note Does not do any actual locking, provided only for interface consistency 104 104 * with other frontends. 105 105 */ 106 106 locked_backend_ptr locked_backend() -
boost/log/sinks/async_frontend.hpp
95 95 private: 96 96 //! Backend synchronization mutex type 97 97 typedef boost::mutex backend_mutex_type; 98 //! Frontend sync ronization mutex type98 //! Frontend synchronization mutex type 99 99 typedef typename base_type::mutex_type frontend_mutex_type; 100 100 101 101 //! A scope guard that implements thread ID management -
boost/log/sinks/attribute_mapping.hpp
251 251 * the native value. 252 252 * 253 253 * \param rec A log record to extract value from 254 * \return A mapped value, if mapping was successful l, or the default value if254 * \return A mapped value, if mapping was successful, or the default value if 255 255 * mapping did not succeed. 256 256 */ 257 257 mapped_type operator() (record_view const& rec) const -
boost/log/sinks/frontend_requirements.hpp
46 46 /*! 47 47 * The sink backend expects pre-synchronized calls, all needed synchronization is implemented 48 48 * in the frontend (IOW, only one thread is feeding records to the backend concurrently, but 49 * i sis possible for several threads to write sequentially). Note that if a frontend supports49 * it is possible for several threads to write sequentially). Note that if a frontend supports 50 50 * synchronized record feeding, it will also report capable of concurrent record feeding. 51 51 */ 52 52 struct synchronized_feeding {}; -
boost/log/core/record.hpp
36 36 /*! 37 37 * \brief Logging record class 38 38 * 39 * The logging record incapsulates all information related to a single logging statement,39 * The logging record encapsulates all information related to a single logging statement, 40 40 * in particular, attribute values view and the log message string. The record can be updated before pushing 41 41 * for further processing to the logging core. 42 42 */ -
boost/log/core/core.hpp
188 188 * every log record made in the current thread. 189 189 * 190 190 * \note In single-threaded build the effect is the same as adding the attribute globally. This, however, does 191 * not imply that iterators to thread-specific and global attributes are interchang able.191 * not imply that iterators to thread-specific and global attributes are interchangeable. 192 192 * 193 193 * \param name The attribute name. 194 194 * \param attr The attribute factory. -
boost/log/core/record_view.hpp
42 42 /*! 43 43 * \brief Logging record view class 44 44 * 45 * The logging record incapsulates all information related to a single logging statement,45 * The logging record encapsulates all information related to a single logging statement, 46 46 * in particular, attribute values view and the log message string. The view is immutable, 47 47 * it is implemented as a wrapper around a reference-counted implementation. 48 48 */ -
boost/log/trivial.hpp
48 48 fatal 49 49 }; 50 50 51 //! Returns stringi fied enumeration value or \c NULL, if the value is not valid51 //! Returns stringized enumeration value or \c NULL, if the value is not valid 52 52 BOOST_LOG_API const char* to_string(severity_level lvl); 53 53 54 54 template< typename CharT, typename TraitsT > -
boost/log/detail/unary_function_terminal.hpp
39 39 namespace aux { 40 40 41 41 /*! 42 * \brief An adapter for a nunary function to be used as a terminal in a Boost.Phoenix expression42 * \brief An adapter for a unary function to be used as a terminal in a Boost.Phoenix expression 43 43 * 44 * This class is an adapter between Boost.Phoenix expression invo kation protocol and45 * a nunary function. It forwards the call to the base function, passing only the first argument46 * from the original call. This allows to toembed value extractors in template expressions.44 * This class is an adapter between Boost.Phoenix expression invocation protocol and 45 * a unary function. It forwards the call to the base function, passing only the first argument 46 * from the original call. This allows to embed value extractors in template expressions. 47 47 */ 48 48 template< typename FunT > 49 49 class unary_function_terminal -
boost/log/utility/explicit_operator_bool.hpp
10 10 * \date 08.03.2009 11 11 * 12 12 * This header defines a compatibility macro that implements an unspecified 13 * \c bool operator idiom, which is super ceded with explicit conversion operators in13 * \c bool operator idiom, which is superseded with explicit conversion operators in 14 14 * C++0x. 15 15 */ 16 16 -
boost/log/utility/record_ordering.hpp
78 78 result_type operator() (record_view const& left, record_view const& right) const 79 79 { 80 80 // We rely on the fact that the attribute_values() method returns a reference to the object in the record implementation, 81 // so we can com are pointers.81 // so we can compare pointers. 82 82 return FunT::operator() (static_cast< const void* >(&left.attribute_values()), static_cast< const void* >(&right.attribute_values())); 83 83 } 84 84 }; … … 86 86 /*! 87 87 * \brief Ordering predicate, based on attribute values associated with records 88 88 * 89 * This predicate allows to order log records based on values of a specific ly named attribute89 * This predicate allows to order log records based on values of a specifically named attribute 90 90 * associated with them. Two given log records being compared should both have the specified 91 91 * attribute value of the specified type to be able to be ordered properly. As a special case, 92 92 * if neither of the records have the value, these records are considered equivalent. Otherwise, -
boost/log/utility/value_ref.hpp
404 404 * since it may be empty (i.e. refer to no value at all) and it can also refer to values of different types. Therefore its 405 405 * interface and behavior combines features of Boost.Ref, Boost.Optional and Boost.Variant, depending on the use case. 406 406 * 407 * The template parameter \c T can be a single type or an MPL seq ence of possible types being referred. The reference wrapper407 * The template parameter \c T can be a single type or an MPL sequence of possible types being referred. The reference wrapper 408 408 * will act as either an optional reference or an optional variant of references to the specified types. In any case, the 409 409 * referred values will not be modifiable (i.e. \c value_ref always models a const reference). 410 410 * -
boost/log/utility/setup/filter_parser.hpp
137 137 * The base class for filter factories. The class defines default implementations for most 138 138 * filter expressions. In order to be able to construct filters, the attribute value type must 139 139 * support reading from a stream. Also, the default filters will rely on relational operators for 140 * the type, so these op trators must also be defined.140 * the type, so these operators must also be defined. 141 141 */ 142 142 template< typename CharT, typename AttributeValueT > 143 143 class basic_filter_factory : -
boost/log/utility/setup/console.hpp
168 168 * or a filter lambda expression. 169 169 * \li \c format Specifies a formatter to install into the sink. May be a string that represents a formatter, 170 170 * or a formatter lambda expression (either streaming or Boost.Format-like notation). 171 * \li \c auto_flush A boolean flag that shows whether the sink should automaticall uflush the stream171 * \li \c auto_flush A boolean flag that shows whether the sink should automatically flush the stream 172 172 * after each written record. 173 173 * \return Pointer to the constructed sink. 174 174 */ -
boost/log/utility/functional/logical.hpp
14 14 * header are not templates and therefore do not require a fixed argument type. Furthermore, both arguments 15 15 * may have different types, in which case the comparison is performed without type conversion. 16 16 * 17 * \note In case if arguments are inte rgal, the conversion is performed according to the standard C++ rules17 * \note In case if arguments are integral, the conversion is performed according to the standard C++ rules 18 18 * in order to avoid warnings from the compiler. 19 19 */ 20 20 -
libs/log/test/run/attr_attribute_value_impl.cpp
126 126 BOOST_CHECK(!p4.dispatch(disp)); 127 127 } 128 128 129 // The test verifies that value extrac ition works129 // The test verifies that value extraction works 130 130 BOOST_AUTO_TEST_CASE(value_extraction) 131 131 { 132 132 logging::attribute_value p1(attrs::make_attribute_value< int >(10)); -
libs/log/test/run/util_string_literal.cpp
192 192 BOOST_CHECK_EQUAL(lit1, "yo-ho-ho"); 193 193 } 194 194 195 // STL strings acquisi on tests195 // STL strings acquisition tests 196 196 BOOST_AUTO_TEST_CASE(string_literal_str) 197 197 { 198 198 logging::string_literal lit = "yo-ho-ho"; -
libs/log/doc/tutorial.qbk
57 57 58 58 [heading File logging unleashed] 59 59 60 As a starting point, here is how you would initialize loggin ig to a file:60 As a starting point, here is how you would initialize logging to a file: 61 61 62 62 [example_tutorial_file_simple] 63 63 … … 117 117 118 118 Regardless of the thread safety, all loggers provided by the library are default and copy-constructible and support swapping, so there should be no problem in making a logger a member of your class. As you will see later, such approach can give you additional benefits. 119 119 120 The library provides a number of loggers with different features, such as severity and channel support. These features can be combined with each other in order to construct more complex loggers. See [link log.detailed.sources here] for more d atails.120 The library provides a number of loggers with different features, such as severity and channel support. These features can be combined with each other in order to construct more complex loggers. See [link log.detailed.sources here] for more details. 121 121 122 122 [heading Global logger objects] 123 123 … … 155 155 156 156 In previous sections we mentioned attributes and attribute values several times. Here we will discover how attributes can be used to add more data to log records. 157 157 158 Each log record can have a number of named attribute values attached. Attributes can represent any essent al information about the conditions in which the log record occurred, such as position in the code, executable module name, current date and time, or any piece of data relevant to your particular application and execution environment. An attribute may behave as a value generator, in which case it would return a different value for each log record it's involved in. As soon as the attribute generates the value, the latter becomes independent from the creator and can be used by filters, formatters and sinks. But in order to use the attribute value one has to know its name and type, or at least a set of types it may have. There are a number of commonly used attributes implemented in the library, you can find the types of their values in the documentation.158 Each log record can have a number of named attribute values attached. Attributes can represent any essential information about the conditions in which the log record occurred, such as position in the code, executable module name, current date and time, or any piece of data relevant to your particular application and execution environment. An attribute may behave as a value generator, in which case it would return a different value for each log record it's involved in. As soon as the attribute generates the value, the latter becomes independent from the creator and can be used by filters, formatters and sinks. But in order to use the attribute value one has to know its name and type, or at least a set of types it may have. There are a number of commonly used attributes implemented in the library, you can find the types of their values in the documentation. 159 159 160 160 Aside from that, as described in the [link log.design Design overview] section, there are three possible scopes of attributes: source-specific, thread-specific and global. When a log record is made, attribute values from these three sets are joined into a single set and passed to sinks. This implies that the origin of the attribute makes no difference for sinks. Any attribute can be registered in any scope. When registered, an attribute is given a unique name in order to make it possible to search for it. If it happens that the same named attribute is found in several scopes, the attribute from the most specific scope is taken into consideration in any further processing, including filtering and formatting. Such behavior makes it possible to override global or thread-scoped attributes with the ones registered in your local logger, thus reducing thread interference. 161 161 … … 175 175 176 176 The [funcref boost::log::add_common_attributes `add_common_attributes`] function is one of the several convenience helpers described [link log.detailed.utilities.setup.convenience here]. 177 177 178 Some attr ubutes are registered automatically on loggers construction. For example, [link log.detailed.sources.severity_level_logger `severity_logger`] registers a source-specific attribute "Severity" which can be used to add a level of emphasis for different log records. For example:178 Some attributes are registered automatically on loggers construction. For example, [link log.detailed.sources.severity_level_logger `severity_logger`] registers a source-specific attribute "Severity" which can be used to add a level of emphasis for different log records. For example: 179 179 180 180 [example_sources_severity] 181 181 … … 200 200 // other attributes skipped for brevity 201 201 } 202 202 203 Here the [link log.detailed.attributes.counter `counter`] and [link log.detailed.attributes.clock `local_clock`] components are attribute classes, they derive from the common attribute interface [class_log_attribute]. The library provides a number of other [link log.detailed.attributes attribute classes], including the [link log.detailed.attributes.function `function`] attribute that calls some function object on value acquisition. For example, we can in a similar way register a [link log.detailed.attributes.named_scope `named_scope`] attr ubute:203 Here the [link log.detailed.attributes.counter `counter`] and [link log.detailed.attributes.clock `local_clock`] components are attribute classes, they derive from the common attribute interface [class_log_attribute]. The library provides a number of other [link log.detailed.attributes attribute classes], including the [link log.detailed.attributes.function `function`] attribute that calls some function object on value acquisition. For example, we can in a similar way register a [link log.detailed.attributes.named_scope `named_scope`] attribute: 204 204 205 205 core->add_global_attribute("Scope", attrs::named_scope()); 206 206 … … 260 260 261 261 expr::attr< logging::trivial::severity_level >("Severity") 262 262 263 [tip As shown in the previous section, it is possible to define placeholders like `severity` for user's attributes. As an additional benefit to the simpler syntax in the template expressions such placeholders allow to concentrate all the information about the attribute (the name and the value type) in the placeholder definition. This makes coding less error-prone (you won't misspel the attribute name or specify incorrect value type) and therefore is the recommended way of defining new attributes and using them in template expressions.]263 [tip As shown in the previous section, it is possible to define placeholders like `severity` for user's attributes. As an additional benefit to the simpler syntax in the template expressions such placeholders allow to concentrate all the information about the attribute (the name and the value type) in the placeholder definition. This makes coding less error-prone (you won't misspell the attribute name or specify incorrect value type) and therefore is the recommended way of defining new attributes and using them in template expressions.] 264 264 265 265 There are other [link log.detailed.expressions.formatters formatter manipulators] that provide advanced support for date, time and other types. Some manipulators accept additional arguments that customize their behavior. Most of these arguments are named and can be passed in __boost_parameter__ style. 266 266 … … 274 274 275 275 [heading Boost.Format-style formatters] 276 276 277 As an alternative, you can define formatters with witha syntax similar to __boost_format__. The same formatter as described above can be written as follows:277 As an alternative, you can define formatters with a syntax similar to __boost_format__. The same formatter as described above can be written as follows: 278 278 279 279 [example_tutorial_formatters_format] 280 280 … … 304 304 305 305 [note Textual format templates are not accepted by sink backends in the `set_formatter` method. In order to parse textual template into a formatter function one has to call `parse_formatter` function. See [link log.detailed.utilities.setup.filter_formatter here] for more details.] 306 306 307 [heading Custom formatting funct ons]307 [heading Custom formatting functions] 308 308 309 309 You can add a custom formatter to a sink backend that supports formatting. The formatter is actually a function object that supports the following signature: 310 310 … … 332 332 333 333 In this sample we initialize two sinks - one for the complete log file and the other for important messages only. Both sinks will be writing to text files with the same log record format, which we initialize first and save to the `fmt` variable. The [classref boost::log::basic_formatter formatter] type is a type-erased function object with the formatter calling signature; in many respects it can be viewed similar to `boost::function` or `std::function` except that it is never empty. There is also [classref boost::log::filter a similar function object] for filters. 334 334 335 Notably, the formatter itself contains a filter here. As you can see, the format contains a conditional part that is only present when log records contain the "Tag" attribute. The [link log.detailed.expressions.predicates.has_attr `has_attr`] predicate checks whether the record contain ts the "Tag" attribute value and conrtols whether it is put into the file or not. We used the attribute keyword to specify the name and type of the attribute for the predicate, but it is also possible to specify them in the [link log.detailed.expressions.predicates.has_attr `has_attr`] call site. Conditional formatters are explained in more details [link log.detailed.expressions.formatters.conditional here].335 Notably, the formatter itself contains a filter here. As you can see, the format contains a conditional part that is only present when log records contain the "Tag" attribute. The [link log.detailed.expressions.predicates.has_attr `has_attr`] predicate checks whether the record contains the "Tag" attribute value and controls whether it is put into the file or not. We used the attribute keyword to specify the name and type of the attribute for the predicate, but it is also possible to specify them in the [link log.detailed.expressions.predicates.has_attr `has_attr`] call site. Conditional formatters are explained in more details [link log.detailed.expressions.formatters.conditional here]. 336 336 337 337 Further goes the initialization of the two sinks. The first sink does not have any filter, which means it will save every log record to the file. We call `set_filter` on the second sink to only save log records with severity no less than `warning` or having a "Tag" attribute with value "IMPORTANT_MESSAGE". As you can see, the filter syntax resembles usual C++ very much, especially when attribute keywords are used. 338 338 -
libs/log/doc/utilities.qbk
58 58 59 59 #include <``[boost_log_utility_type_dispatch_static_type_dispatcher_hpp]``> 60 60 61 Static type dispatchers are used when the set of types that needs to be supported for extraction is known at compile time. The [class_log_static_type_dispatcher] class template is parametrized with a MPL type sequence of types that need to be supported. The dispatcher inherits from the [class_log_type_dispatcher] interface which provides the `get_callback` method for aquiring the function object to invoke on the stored value. All you need to do is provide a visitor function object to the dispatcher at construction point and invoke the callback when dispatching the stored value:61 Static type dispatchers are used when the set of types that needs to be supported for extraction is known at compile time. The [class_log_static_type_dispatcher] class template is parametrized with an MPL type sequence of types that need to be supported. The dispatcher inherits from the [class_log_type_dispatcher] interface which provides the `get_callback` method for acquiring the function object to invoke on the stored value. All you need to do is provide a visitor function object to the dispatcher at construction point and invoke the callback when dispatching the stored value: 62 62 63 63 [example_util_static_type_dispatcher] 64 64 … … 149 149 150 150 [heading Abstract record ordering] 151 151 152 The [class_log_abstract_ordering] class allows application of a quick opaque ordering. The result of this ordering is not stable between different runs of the application and in genera gcannot be predicted before the predicate is applied, however it provides the best performance. The [class_log_abstract_ordering] class is a template that is specialized with an optional predicate function that will be able to compare `const void*` pointers. By default an `std::less` equivalent is used.152 The [class_log_abstract_ordering] class allows application of a quick opaque ordering. The result of this ordering is not stable between different runs of the application and in general cannot be predicted before the predicate is applied, however it provides the best performance. The [class_log_abstract_ordering] class is a template that is specialized with an optional predicate function that will be able to compare `const void*` pointers. By default an `std::less` equivalent is used. 153 153 154 154 // A set of unique records 155 155 std::set< logging::record_view, logging::abstract_ordering< > > m_Records; … … 184 184 185 185 The library provides exception handling hooks in different places. Tools, defined in this header, provide an easy way of implementing function objects suitable for such hooks. 186 186 187 An exception handler is a function object that accepts no arguments. The result of the exception handler is ignored and thus should generally be `void`. Exception handlers are called from within `catch` sections by the library, therefore in order to reacquire the exception object it has to rethrow it. The header defines an [class_log_exception_handler] template functor that does just that and then forwards the exception object to a nunary user-defined functional object. The [funcref boost::log::make_exception_handler `make_exception_handler`] function can be used to simplify the handler construction. All expected exception types should be specified explicitly in the call, in the order they would appear in the `catch` sections (i.e. from most specific ones to the most general ones).187 An exception handler is a function object that accepts no arguments. The result of the exception handler is ignored and thus should generally be `void`. Exception handlers are called from within `catch` sections by the library, therefore in order to reacquire the exception object it has to rethrow it. The header defines an [class_log_exception_handler] template functor that does just that and then forwards the exception object to a unary user-defined functional object. The [funcref boost::log::make_exception_handler `make_exception_handler`] function can be used to simplify the handler construction. All expected exception types should be specified explicitly in the call, in the order they would appear in the `catch` sections (i.e. from most specific ones to the most general ones). 188 188 189 189 [example_utility_exception_handler] 190 190 … … 465 465 466 466 Sink settings are divided into separate subsections within the common top-level section "Sinks" - one subsection for each sink. The subsection names should denote a user-defined sink name. For example, "MyFile". 467 467 468 [note Previous versions of the library also supported top-level sections starting with the "Sink:" prefix to describe sink parameters. This syntax is deprecated now, although it still works when parsing a settings file for backward compatibility. The parser will automatically put these sections under the "Sinks" top-level section in the resulting settings cont siner. Support for this syntax will be removed in future releases.]468 [note Previous versions of the library also supported top-level sections starting with the "Sink:" prefix to describe sink parameters. This syntax is deprecated now, although it still works when parsing a settings file for backward compatibility. The parser will automatically put these sections under the "Sinks" top-level section in the resulting settings container. Support for this syntax will be removed in future releases.] 469 469 470 470 [table Sections under the "Sinks" section. Common sink settings. 471 471 [[Parameter] [Format] [Description]] -
libs/log/doc/extension.qbk
28 28 * [class_sinks_formatted_records]. The backend expects formatted log records. The frontend implements formatting to a string with character type defined by the `char_type` typedef within the backend. The formatted string will be passed along with the log record to the backend. The [class_sinks_basic_formatted_sink_backend] base class automatically adds this requirement to the `frontend_requirements` type. 29 29 * [class_sinks_flushing]. The backend supports flushing its internal buffers. If the backend indicates this requirement it has to implement the `flush` method taking no arguments; this method will be called by the frontend when flushed. 30 30 31 [tip By cho sing either of the thread synchronization requirements you effectively allow or prohibit certain [link log.detailed.sink_frontends sink frontends] from being used with your backend.]31 [tip By choosing either of the thread synchronization requirements you effectively allow or prohibit certain [link log.detailed.sink_frontends sink frontends] from being used with your backend.] 32 32 33 33 Multiple requirements can be combined into `frontend_requirements` type with the [class_sinks_combine_requirements] metafunction: 34 34 … … 74 74 75 75 The second notable difference from the previous examples is that `consume` method takes an additional string parameter besides the log record. This is the result of formatting. The `string_type` type is defined by the [class_sinks_basic_formatted_sink_backend] base class and it corresponds to the requested character type. 76 76 77 We don't need to flush any buffers in this example, so we didn't specify the [class_sinks_flushing] requirement and omitted the `flush` method in the backen s. Although we don't need any synchronization in our backend, we specified [class_sinks_synchronized_feeding] requirement so that we don't spawn multiple instances of `notify-send` program and cause a "fork bomb".77 We don't need to flush any buffers in this example, so we didn't specify the [class_sinks_flushing] requirement and omitted the `flush` method in the backend. Although we don't need any synchronization in our backend, we specified [class_sinks_synchronized_feeding] requirement so that we don't spawn multiple instances of `notify-send` program and cause a "fork bomb". 78 78 79 79 Now, the `consume` implementation is trivial: 80 80 … … 283 283 284 284 You can extend filter parser in the similar way you can extend the formatter parser - by registering filter factories for your attribute values into the library. However, since it takes a considerably more complex syntax to describe filters, a filter factory typically implements several generator functions. 285 285 286 Like with formatter parser extension, you can avoid spelling out the filter factory and register a simple fact lry provided by the library:286 Like with formatter parser extension, you can avoid spelling out the filter factory and register a simple factory provided by the library: 287 287 288 288 [example_extension_simple_filter_factory] 289 289 290 In order this to work the user's type should ful lfill these requirements:290 In order this to work the user's type should fulfill these requirements: 291 291 292 292 # Support reading from an input stream with `operator>>`. 293 293 # Support the complete set of comparison and ordering operators. 294 294 295 295 Naturally, all these operators must be visible from the point of the [funcref boost::log::register_simple_filter_factory `register_simple_filter_factory`] call. Note that unlike the simple formatter factory, the filter factory requires the user's type to support reading from a stream. This is so because the filter factory would have to parse the argument of the filter relation from a string. 296 296 297 But we won't get away with a simple filter factory, because our `point` class doesn't have a sensible ordering semantics and thus we cannot define the complete set of operators. We'll have to implement our own filter factory instead. Filter factories derive from the [class_log_filter_factory] interface. This base class declares a number of virtual functions that will be called in order to create filters, according to the filter expression. If some functions are not overrid en by the factory, the corresponding operations are considered to be not supported by the attribute value. But before we define the filter factory we have to improve our `point` class slightly:297 But we won't get away with a simple filter factory, because our `point` class doesn't have a sensible ordering semantics and thus we cannot define the complete set of operators. We'll have to implement our own filter factory instead. Filter factories derive from the [class_log_filter_factory] interface. This base class declares a number of virtual functions that will be called in order to create filters, according to the filter expression. If some functions are not overridden by the factory, the corresponding operations are considered to be not supported by the attribute value. But before we define the filter factory we have to improve our `point` class slightly: 298 298 299 299 [example_extension_filter_parser_point_definition] 300 300 … … 343 343 344 344 As you can see, we read parameters from settings and simply create our sink with them as a result of `create_sink` method. Generally, users are free to name parameters of their sinks the way they like, as long as [link log.detailed.utilities.setup.settings_file settings file format] is adhered. However, it is a good idea to follow the pattern established by the library and reuse parameter names with the same meaning. That is, it should be obvious that the parameter "Filter" means the same for both the library-provided "TextFile" sink and out custom "StatCollector" sink. 345 345 346 After defining the factory we only have to register it with the [funcref boost::log::register_sink_factory `register_sink_factory`] call. The first argument is the new value of the "Destination" parameter in the settings. Whenever the library finds sink description with destination "StatCollector", our factory will be invoked to create the sink. It is also possible to override library-provided destination types with user-defined factories, however it is not poss ble to restore the default factories afterwards.346 After defining the factory we only have to register it with the [funcref boost::log::register_sink_factory `register_sink_factory`] call. The first argument is the new value of the "Destination" parameter in the settings. Whenever the library finds sink description with destination "StatCollector", our factory will be invoked to create the sink. It is also possible to override library-provided destination types with user-defined factories, however it is not possible to restore the default factories afterwards. 347 347 348 348 [note As the "Destination" parameter is used to determine the sink factory, this parameter is reserved and cannot be used by sink factories for their own purposes.] 349 349 -
libs/log/doc/rationale.qbk
105 105 106 106 [section:why_attribute_manips_dont_affect_filters Why attributes set with stream manipulators do not participate in filtering?] 107 107 108 One can add attributes to log records in the followin fway:108 One can add attributes to log records in the following way: 109 109 110 110 BOOST_LOG(logger) << logging::add_value("MyInt", 10) << logging::add_value("MyString", "string attribute value") 111 111 << "Some log message"; … … 181 181 182 182 As a couple quick examples, `v2s_st` corresponds to v2 static single-threaded build of the library and `v2_mt_posix` - to v2 dynamic multi-threaded build for POSIX system API. 183 183 184 Namespace mangling may lead to linkin kg errors if the application is misconfigured. One common mistake is to build dynamic version of the library and not define `BOOST_LOG_DYN_LINK` or `BOOST_ALL_DYN_LINK` when building the application, so that the library assumes static linking by default. Whenever such linking errors appear, one can decode the namespace name in the missing symbols and the exported symbols of Boost.Log library and adjust library or application [link log.installation.config configuration] accordingly.184 Namespace mangling may lead to linking errors if the application is misconfigured. One common mistake is to build dynamic version of the library and not define `BOOST_LOG_DYN_LINK` or `BOOST_ALL_DYN_LINK` when building the application, so that the library assumes static linking by default. Whenever such linking errors appear, one can decode the namespace name in the missing symbols and the exported symbols of Boost.Log library and adjust library or application [link log.installation.config configuration] accordingly. 185 185 186 186 [endsect] 187 187 -
libs/log/doc/expressions.qbk
18 18 #include <``[boost_log_expressions_attr_fwd_hpp]``> 19 19 #include <``[boost_log_expressions_attr_hpp]``> 20 20 21 The [funcref boost::log::expressions::attr attr] placeholder represents an attribute value in template expressions. Given the record view or a set of attribute values, the placeholder will attempt to extract the specified attribute value from the argument upon invo kation. This can be roughly described with the following pseudo-code:21 The [funcref boost::log::expressions::attr attr] placeholder represents an attribute value in template expressions. Given the record view or a set of attribute values, the placeholder will attempt to extract the specified attribute value from the argument upon invocation. This can be roughly described with the following pseudo-code: 22 22 23 23 logging::value_ref< T, TagT > val = expr::attr< T, TagT >(name)(rec); 24 24 … … 156 156 157 157 [@boost:/libs/log/example/doc/expressions_has_attr_stat_accum.cpp See the complete code]. 158 158 159 In this example, log records emitted with the `PUT_STAT` mac to will be directed to the `my_stat_accumulator` sink backend, which will accumulate the changes passed in the "Change" attribute values. All other records (even those made through the same logger) will be passed to the filtesink. This is achieved with the mutually exclusive filters set for the two sinks.159 In this example, log records emitted with the `PUT_STAT` macro will be directed to the `my_stat_accumulator` sink backend, which will accumulate the changes passed in the "Change" attribute values. All other records (even those made through the same logger) will be passed to the filter sink. This is achieved with the mutually exclusive filters set for the two sinks. 160 160 161 161 Please note that in the example above we extended the library in two ways: we defined a new sink backend `my_stat_accumulator` and a new macro `PUT_STAT`. Also note that `has_attr` can accept attribute keywords to identify the attribute to check. 162 162 … … 509 509 510 510 #include <``[boost_log_expressions_formatters_c_decorator_hpp]``> 511 511 512 The header defines two character decorators: `c_decor` and `c_ascii_decor`. The first one replaces the following characters with their escaped coun erparts: \\ (backslash, 0x5c), \\a (bell character, 0x07), \\b (backspace, 0x08), \\f (formfeed, 0x0c), \\n (newline, 0x0a), \\r (carriage return, 0x0d), \\t (horizontal tabulation, 0x09), \\v (vertical tabulation, 0x0b), \' (apostroph, 0x27), \" (quote, 0x22), ? (question mark, 0x3f). The `c_ascii_decor` decorator does the same but also replaces all other non-printable and non-ASCII characters with escaped hexadecimal character codes in C notation (e.g. "\\x8c"). The usage is similar to other character decorators:512 The header defines two character decorators: `c_decor` and `c_ascii_decor`. The first one replaces the following characters with their escaped counterparts: \\ (backslash, 0x5c), \\a (bell character, 0x07), \\b (backspace, 0x08), \\f (formfeed, 0x0c), \\n (newline, 0x0a), \\r (carriage return, 0x0d), \\t (horizontal tabulation, 0x09), \\v (vertical tabulation, 0x0b), \' (apostroph, 0x27), \" (quote, 0x22), ? (question mark, 0x3f). The `c_ascii_decor` decorator does the same but also replaces all other non-printable and non-ASCII characters with escaped hexadecimal character codes in C notation (e.g. "\\x8c"). The usage is similar to other character decorators: 513 513 514 514 sink->set_formatter 515 515 ( -
libs/log/doc/sources.qbk
52 52 53 53 [example_sources_network_connection_channels] 54 54 55 It is also possible to set the channel name of individual log records. This can be u esful when a [link log.detailed.sources.global_storage global logger] is used instead of an object-specific one. The channel name can be set by calling the `channel` modifier on the logger or by using a special macro for logging. For example:55 It is also possible to set the channel name of individual log records. This can be useful when a [link log.detailed.sources.global_storage global logger] is used instead of an object-specific one. The channel name can be set by calling the `channel` modifier on the logger or by using a special macro for logging. For example: 56 56 57 57 [example_sources_network_connection_dynamic_channels] 58 58 -
libs/log/doc/attributes.qbk
380 380 381 381 Working with identifiers is much more efficient than with strings. For example, copying does not involve dynamic memory allocation and comparison operators are very lightweight. On the other hand, it is easy to get a human-readable attribute name for presentation, if needed. 382 382 383 The [class_log_attribute_name] class supports an empty (uninitialized) state when default constructed. In this state the name object is not equal to any other initialized name object. Uni tnitialized attribute names should not be passed to the library but can be useful in some contexts (e.g. when a delayed initialization is desired).383 The [class_log_attribute_name] class supports an empty (uninitialized) state when default constructed. In this state the name object is not equal to any other initialized name object. Uninitialized attribute names should not be passed to the library but can be useful in some contexts (e.g. when a delayed initialization is desired). 384 384 385 385 [endsect] 386 386 … … 396 396 397 397 #include <``[boost_log_attributes_attribute_value_set_hpp]``> 398 398 399 Attribute value set is an unordered assoc oative container that maps [link log.detailed.attributes.related_components.attribute_name attribute names] to [link log.detailed.attributes attribute values]. This container is used in log [link log.detailed.core.record records] to represent attribute values. Unlike conventional containers, [class_log_attribute_value_set] does not support removing or modifying elements after being inserted. This warrants that the attribute values that participated filtering will not disappear from the log record in the middle of the processing.399 Attribute value set is an unordered associative container that maps [link log.detailed.attributes.related_components.attribute_name attribute names] to [link log.detailed.attributes attribute values]. This container is used in log [link log.detailed.core.record records] to represent attribute values. Unlike conventional containers, [class_log_attribute_value_set] does not support removing or modifying elements after being inserted. This warrants that the attribute values that participated filtering will not disappear from the log record in the middle of the processing. 400 400 401 Additionally, the set can be constructed from three [link log.detailed.attributes.related_components.attribute_set attribute sets], which are interpreted as the sets of source-specific, thread-specific and global attributes. The constructor adopts attribute values from the three attribute sets into a single set of attribute values. After construction, [class_log_attribute_value_set] is considered to be in an unfrozen state. This means that the container may keep references to the elements of the attribute sets used as the source for the value set construction. While in this state, neither the attribute sets nor the value set must not be modified in any way as this may make the value set corrupted. The value set can be used for reading in this state, its lookup operations will perform as usual. The value set can be frozen by calling the `freeze` method; the set will no longer be attached to the original attribute sets and will be available for further insertions after this call. The library will ensure that the value set is always fro sen when a log record is returned from the logging core; the set is [_not] frozen during filtering though.401 Additionally, the set can be constructed from three [link log.detailed.attributes.related_components.attribute_set attribute sets], which are interpreted as the sets of source-specific, thread-specific and global attributes. The constructor adopts attribute values from the three attribute sets into a single set of attribute values. After construction, [class_log_attribute_value_set] is considered to be in an unfrozen state. This means that the container may keep references to the elements of the attribute sets used as the source for the value set construction. While in this state, neither the attribute sets nor the value set must not be modified in any way as this may make the value set corrupted. The value set can be used for reading in this state, its lookup operations will perform as usual. The value set can be frozen by calling the `freeze` method; the set will no longer be attached to the original attribute sets and will be available for further insertions after this call. The library will ensure that the value set is always frozen when a log record is returned from the logging core; the set is [_not] frozen during filtering though. 402 402 403 403 [tip In the unfrozen state the value set may not have all attribute values acquired from the attributes. It will only acquire the values as requested by filters. After freezing the container has all attribute values. This transition allows to optimize the library so that attribute values are only acquired when needed.] 404 404 405 For fu ther details on the container interface please consult the [class_log_attribute_value_set] reference.405 For further details on the container interface please consult the [class_log_attribute_value_set] reference. 406 406 407 407 [endsect] 408 408 … … 415 415 #include <``[boost_log_attributes_value_visitation_fwd_hpp]``> 416 416 #include <``[boost_log_attributes_value_visitation_hpp]``> 417 417 418 Attribute value visitation implements the visitor design pattern, hence the naming. The user has to provide a nunary function object (a visitor) which will be invoked on the stored attribute value. The caller also has to provide the expected type or set of possible types of the stored value. Obviously, the visitor must be capable of receiving an argument of the expected type. Visitation will only succeed if the stored type matches the expectation.418 Attribute value visitation implements the visitor design pattern, hence the naming. The user has to provide a unary function object (a visitor) which will be invoked on the stored attribute value. The caller also has to provide the expected type or set of possible types of the stored value. Obviously, the visitor must be capable of receiving an argument of the expected type. Visitation will only succeed if the stored type matches the expectation. 419 419 420 420 In order to apply the visitor, one should call the [funcref boost::log::visit `visit`] function on the attribute value. Let's see an example: 421 421 … … 426 426 In this example we print the stored attribute value in our `print_visitor`. We expect the attribute value to have either `int` or `std::string` stored type; only in this case the visitor will be invoked and the visitation result will be positive. In case of failure the [class_log_visitation_result] class provides additional information on the failure reason. The class has the method named `code` which returns visitation error code. The following error codes are possible: 427 427 428 428 * `ok` - visitation succeeded, the visitor has been invoked; visitation result is positive when this code is used 429 * `value_not_found` - visitation failed because the requested value was not found; this code is used when visitation is applied to a log record or a set of attri nute values rather than a single value429 * `value_not_found` - visitation failed because the requested value was not found; this code is used when visitation is applied to a log record or a set of attribute values rather than a single value 430 430 * `value_has_invalid_type` - visitation failed because the value has type differing from any of the expected types 431 431 432 432 By default the visitor function result is ignored but it is possible to obtain it. To do this one should use a special [funcref boost::log::save_result `save_result`] wrapper for the visitor; the wrapper will save the visitor resulting value into an external variable captured by reference. The visitor result is initialized when the returned [class_log_visitation_result] is positive. See the following example where we compute the hash value on the stored value. … … 458 458 459 459 In this example we expect the attribute value to have the stored type `int`. The [funcref boost::log::extract `extract`] function attempts to extract a reference to the stored value and returns the filled [link log.detailed.utilities.value_ref `value_ref`] object if succeeded. 460 460 461 Value extraction can also be used with a set of expected stored types. The foll woing code snippet demonstrates this:461 Value extraction can also be used with a set of expected stored types. The following code snippet demonstrates this: 462 462 463 463 [example_attr_value_extraction_multiple_types] 464 464 -
libs/log/doc/sink_frontends.qbk
39 39 40 40 [tip [link log.detailed.core.core.exception_handling Logging core] and [link log.detailed.sources.exception_handling loggers] also support installing exception handlers.] 41 41 42 The library provides a [link log.detailed.utilities.exception_handlers convenient tool] for dispatching exceptions into a nunary polymorphic function object.42 The library provides a [link log.detailed.utilities.exception_handlers convenient tool] for dispatching exceptions into a unary polymorphic function object. 43 43 44 44 [note An exception handler is not allowed to return a value. This means you are not able to alter the filtering result once an exception occurs, and thus filtering will always fail.] 45 45 -
libs/log/doc/changelog.qbk
51 51 * Attribute sets and attribute value sets no longer maintain order of elements. Although it wasn't stated explicitly, the containers used to be ordered associative containers. Now the order of elements is unspecified. The implementation has been reworked to speed up insertion/removal of attributes, as well as attribute lookup and values set construction. The drawback is that memory footprint may get increased in some cases. 52 52 * Attribute sets now use small memory pools to speed up element insertion/removal. 53 53 * The header `scoped_attribute.hpp` moved from `utility` to the `attributes` directory. The header `attribute_value_extractor.hpp` in `utility` has been replaced with headers [boost_log_attributes_value_extraction_hpp] and [boost_log_attributes_value_visitation_hpp] in the `attributes` directory. The two new headers define the revised API of attribute value extraction and visitation, respectively. See [link log.detailed.attributes.related_components.value_processing here] for more details. 54 * [link log.detailed.attributes.related_components.scoped_attributes Scoped att ibute] macros simplified. The attribute constructor arguments are specified next to the attribute type and tag type is no longer required.54 * [link log.detailed.attributes.related_components.scoped_attributes Scoped attribute] macros simplified. The attribute constructor arguments are specified next to the attribute type and tag type is no longer required. 55 55 * The [link log.detailed.attributes.thread_id `current_thread_id`] attribute no longer uses `boost::thread::id` type for thread identification. An internal type is used instead, the type is accessible as `current_thread_id::value_type`. The new thread ids are taken from the underlying OS API and thus more closely correlate to what may be displayed by debuggers and system diagnostic tools. 56 56 * Added [link log.detailed.attributes.process_name `current_process_name`] attribute. The attribute generates a string with the executable name of the current process. 57 57 * The `functor` attribute has been renamed to [class_attributes_function]. The generator function has been renamed from `make_functor_attr` to `make_function`. The header has been renamed from `functor.hpp` to `function.hpp`. … … 69 69 * Formatting functionality moved to sink frontends. Sink backends that support record formatting derive from the `basic_formatting_sink_backend` class template, which indicates to the frontend that record formatting is required. This breaks user-side API of the library: the formatter and locale has to be set to the frontend rather than backend. 70 70 * Formatting support no longer makes frontend thread synchronization mandatory. Formatting is done prior to locking for processing the record in the backend and can be performed concurrently in multiple threads. 71 71 * Added support for flushing sinks. A sink backend that supports flushing has to define public method with the following signature: `void flush()`. 72 * Asynchronous sink frontend reworke rd, ordering asynchronous sink removed. The [class_sinks_asynchronous_sink] class template now allows to specify record queueing strategy. Several strategies provided, including [class_sinks_unbounded_fifo_queue] (the default) and [class_sinks_unbounded_ordering_queue] which cover the functionality of asynchronous sink frontends in 1.x releases. See the [link log.detailed.sink_frontends.async asynchronous sink frontend] docs for more details.72 * Asynchronous sink frontend reworked, ordering asynchronous sink removed. The [class_sinks_asynchronous_sink] class template now allows to specify record queueing strategy. Several strategies provided, including [class_sinks_unbounded_fifo_queue] (the default) and [class_sinks_unbounded_ordering_queue] which cover the functionality of asynchronous sink frontends in 1.x releases. See the [link log.detailed.sink_frontends.async asynchronous sink frontend] docs for more details. 73 73 * Lock-free FIFO record queueing in asynchronous sinks reworked to reduce log record processing stalls. 74 74 * Added `Append` configuration file parameter for text file sinks. If this parameter is set to `true`, the sink will append log records to the existing log file instead of overwriting it. 75 75 * Added bounded variants of asynchronous sink frontends. Implemented two strategies to handle queue overflows: either log records are dropped or logging threads are blocked until there is space in the queue. … … 129 129 * Added a new ordering asynchronous sink frontend. 130 130 * The [link log.detailed.sink_backends.syslog syslog] sink backend is now supported on Windows, too. The sink no longer requires native support for POSIX API for syslog, but is able to send syslog packets to a remote server over UDP. 131 131 * Loggers implementation has been improved. Feature composition mechanism has been cleaned up. 132 * Added support for scoped logging. There is now a distinct [link log.detailed.core.record log record entity], which is returned by the core as a result of filtering. It is possible to fill in the record message in any way the user wants, not necessaril ly with a streaming expression. The record object is now processed by sinks and formatters.132 * Added support for scoped logging. There is now a distinct [link log.detailed.core.record log record entity], which is returned by the core as a result of filtering. It is possible to fill in the record message in any way the user wants, not necessarily with a streaming expression. The record object is now processed by sinks and formatters. 133 133 * Added support for exception control. User can register exception handlers at one of the three layers: for a particular sink, at the core layer, and for a particular logger (given that it has the appropriate feature). Sinks and core will not suppress exceptions by default. Filter and formatters will throw if the requested attribute value is not found. 134 134 * Added a few new formatters, called character decorators. These can be useful to post-process the formatted output before passing it on to the sink. 135 135 * Added attributes for thread and process identifiers. These identifiers are automatically added after the call to `add_common_attributes`. 136 136 * Helper initialization functions, such as `init_log_to_file` now accept more customization options as named arguments. 137 137 * A new [link log.detailed.utilities.setup.settings initialization interface] has been exposed. One can fill a settings container and use it to initialize the library. 138 * The library setup support code has bee dextracted into a separate binary. Further on, this binary will be made optional to build.138 * The library setup support code has been extracted into a separate binary. Further on, this binary will be made optional to build. 139 139 * Added a new mode of logging, called trivial logging. In this mode the library requires no initialization at all, however it does not offer many ways of customization. 140 140 * A number of bugs fixed. 141 141 * A few optimizations added to improve multithreaded applications performance. … … 153 153 154 154 [heading Release Candidate 2] 155 155 156 No one really remembers these dark ages...156 No one really remembers these dark ages... 157 157 158 158 [endsect] -
libs/log/doc/core.qbk
116 116 // ... 117 117 } 118 118 119 The core also provides another way to disable logging. By calling the `set_logging_enabled` with a boolean argument one may completely disable or re enable logging, including applying filtering. Disabling logging with this method may be more benefical in terms of application performance than setting a global filter that always fails.119 The core also provides another way to disable logging. By calling the `set_logging_enabled` with a boolean argument one may completely disable or re-enable logging, including applying filtering. Disabling logging with this method may be more beneficial in terms of application performance than setting a global filter that always fails. 120 120 121 121 [endsect] 122 122 -
libs/log/doc/sink_backends.qbk
162 162 163 163 #include <``[boost_log_sinks_syslog_backend_hpp]``> 164 164 165 The syslog backend, as comes from its name, provides support for the syslog API that is available on virtually any UNIX-like platform. On Windows there exists at least [@http://syslog-win32.sourceforge.net one] public implementation of the syslog client API. However, in order to provide maximum flexibi bity and better portability the library offers built-in support for the syslog protocol described in [@http://tools.ietf.org/html/rfc3164 RFC 3164]. Thus on Windows only the built-in implementation is supported, while on UNIX-like systems both built-in and system API based implementations are supported.165 The syslog backend, as comes from its name, provides support for the syslog API that is available on virtually any UNIX-like platform. On Windows there exists at least [@http://syslog-win32.sourceforge.net one] public implementation of the syslog client API. However, in order to provide maximum flexibility and better portability the library offers built-in support for the syslog protocol described in [@http://tools.ietf.org/html/rfc3164 RFC 3164]. Thus on Windows only the built-in implementation is supported, while on UNIX-like systems both built-in and system API based implementations are supported. 166 166 167 167 The backend is implemented in the [class_sinks_syslog_backend] class. The backend supports formatting log records, and therefore requires thread synchronization in the frontend. The backend also supports severity level translation from the application-specific values to the syslog-defined values. This is achieved with an additional function object, level mapper, that receives a set of attribute values of each log record and returns the appropriate syslog level value. This value is used by the backend to construct the final priority value of the syslog record. The other component of the syslog priority value, the facility, is constant for each backend object and can be specified in the backend constructor arguments. 168 168 … … 176 176 177 177 Also note that the backend will default to the built-in implementation and `user` logging facility, if the corresponding constructor parameters are not specified. 178 178 179 [tip The `set_target_address` method will also accept DNS names, which it will resolve to the actual IP address. This featu e, however, is not available in single threaded builds.]179 [tip The `set_target_address` method will also accept DNS names, which it will resolve to the actual IP address. This feature, however, is not available in single threaded builds.] 180 180 181 181 [endsect] 182 182 -
libs/log/src/process_id.cpp
96 96 if (strm.good()) 97 97 { 98 98 io::ios_flags_saver flags_saver(strm, std::ios_base::hex | std::ios_base::showbase); 99 // The width is set calculated to accom odate pid in hex + "0x" prefix99 // The width is set calculated to accommodate pid in hex + "0x" prefix 100 100 io::ios_width_saver width_saver(strm, static_cast< std::streamsize >(pid_size * 2 + 2)); 101 101 io::basic_ios_fill_saver< CharT, TraitsT > fill_saver(strm, static_cast< CharT >('0')); 102 102 strm << static_cast< uint_t< pid_size * 8 >::least >(pid.native_id()); -
libs/log/src/filter_parser.cpp
198 198 operand = 199 199 ( 200 200 quoted_string_operand | 201 // A single word, enclosed with white spaces. It cannot contain parenthesis, since i sis used by the filter parser.201 // A single word, enclosed with white spaces. It cannot contain parenthesis, since it is used by the filter parser. 202 202 qi::raw[ qi::lexeme[ +(encoding_specific::graph - qi::lit(constants::char_paren_bracket_left) - qi::lit(constants::char_paren_bracket_right)) ] ] 203 203 [boost::bind(&filter_grammar::on_operand, this, _1)] 204 204 ); … … 242 242 ); 243 243 } 244 244 245 //! The method returns the c instructed filter245 //! The method returns the constructed filter 246 246 filter get_filter() 247 247 { 248 248 BOOST_ASSERT(!m_Subexpressions.empty()); -
libs/log/src/attribute_name.cpp
122 122 123 123 //! The container that provides storage for nodes 124 124 typedef std::deque< node > node_list; 125 //! The con ainer that provides name-based lookup125 //! The container that provides name-based lookup 126 126 typedef intrusive::set< 127 127 node, 128 128 intrusive::base_hook< node_by_name_hook >, -
libs/log/src/event_log_registry.hpp
71 71 std::string source_name(buf, buf + size); 72 72 if (source_name.empty()) 73 73 { 74 // In case of error we provide artific al application name74 // In case of error we provide artificial application name 75 75 std::ostringstream strm; 76 76 strm << "Boost.Log " 77 77 << static_cast< unsigned int >(BOOST_VERSION / 100000) … … 187 187 std::wstring source_name(buf, buf + size); 188 188 if (source_name.empty()) 189 189 { 190 // In case of error we provide artific al application name190 // In case of error we provide artificial application name 191 191 std::wostringstream strm; 192 192 strm << L"Boost.Log " 193 193 << static_cast< unsigned int >(BOOST_VERSION / 100000) -
libs/log/src/syslog_backend.cpp
528 528 } 529 529 #else 530 530 // Boost.ASIO requires threads for the host name resolver, 531 // so without threads w isimply assume the string already contains IP address531 // so without threads we simply assume the string already contains IP address 532 532 set_local_address(boost::asio::ip::address::from_string(addr), port); 533 533 #endif // !defined(BOOST_LOG_NO_THREADS) 534 534 } … … 564 564 } 565 565 #else 566 566 // Boost.ASIO requires threads for the host name resolver, 567 // so without threads w isimply assume the string already contains IP address567 // so without threads we simply assume the string already contains IP address 568 568 set_target_address(boost::asio::ip::address::from_string(addr), port); 569 569 #endif // !defined(BOOST_LOG_NO_THREADS) 570 570 } -
libs/log/example/advanced_usage/main.cpp
98 98 // Here synchronous_sink is a sink frontend that performs thread synchronization 99 99 // before passing log records to the backend (the text_ostream_backend class). 100 100 // The backend formats each record and outputs it to one or several streams. 101 // This approach makes implementing backends a lot simpl ier, because you don't101 // This approach makes implementing backends a lot simpler, because you don't 102 102 // need to worry about multithreading. 103 103 104 104 { -
libs/log/example/doc/core_record.cpp
94 94 //[ example_core_record_subscript 95 95 BOOST_LOG_ATTRIBUTE_KEYWORD(severity, "Severity", severity_level) 96 96 97 // Prints severity level by using the subscript oper eator97 // Prints severity level by using the subscript operator 98 98 void print_severity_subscript(logging::record const& rec) 99 99 { 100 100 // Use the attribute keyword to communicate the name and type of the value -
libs/log/example/bounded_async_log/main.cpp
57 57 // Wait until all threads are created 58 58 bar.wait(); 59 59 60 // Here we go. First, ident fy the thread.60 // Here we go. First, identify the thread. 61 61 BOOST_LOG_SCOPED_THREAD_TAG("ThreadID", boost::this_thread::get_id()); 62 62 63 63 // Now, do some logging -
libs/log/example/async_log/main.cpp
57 57 // Wait until all threads are created 58 58 bar.wait(); 59 59 60 // Here we go. First, ident fy the thread.60 // Here we go. First, identify the thread. 61 61 BOOST_LOG_SCOPED_THREAD_TAG("ThreadID", boost::this_thread::get_id()); 62 62 63 63 // Now, do some logging