]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/log/example/doc/core_core_manual.cpp
2 * Copyright Andrey Semashev 2007 - 2015.
3 * Distributed under the Boost Software License, Version 1.0.
4 * (See accompanying file LICENSE_1_0.txt or copy at
5 * http://www.boost.org/LICENSE_1_0.txt)
8 #include <boost/smart_ptr/shared_ptr.hpp>
9 #include <boost/move/utility_core.hpp>
10 #include <boost/log/core.hpp>
11 #include <boost/log/sources/record_ostream.hpp>
13 namespace logging
= boost::log
;
15 //[ example_core_core_manual_logging
16 void logging_function(logging::attribute_set
const& attrs
)
18 boost::shared_ptr
< logging::core
> core
= logging::core::get();
20 // Attempt to open a log record
21 logging::record rec
= core
->open_record(attrs
);
24 // Ok, the record is accepted. Compose the message now.
25 logging::record_ostream
strm(rec
);
26 strm
<< "Hello, World!";
29 // Deliver the record to the sinks.
30 core
->push_record(boost::move(rec
));
35 int main(int, char*[])
37 logging_function(logging::attribute_set());