Skip to content
Snippets Groups Projects
Verified Commit 47a4713c authored by Timm Fitschen's avatar Timm Fitschen
Browse files

FIX: add more operator<< variants to logging

parent 3e34abaa
No related branches found
No related tags found
2 merge requests!42Release 0.2.0,!41F octave logging
Pipeline #25398 canceled
......@@ -27,6 +27,7 @@
#include <cstdint> // for uint64_t
#include <iosfwd> // for streamsize
#include <memory> // for shared_ptr
#include <ostream> // for ostream
#include <string> // for string
#include <vector> // for vector
......@@ -37,6 +38,8 @@ const std::string logger_name = "caosdb::logging";
class LoggerOutputStream {
public:
LoggerOutputStream(std::string channel, int level);
auto operator<<(std::ostream &(*f)(std::ostream &)) -> LoggerOutputStream &;
auto operator<<(bool msg) -> LoggerOutputStream &;
auto operator<<(int msg) -> LoggerOutputStream &;
auto operator<<(uint64_t msg) -> LoggerOutputStream &;
auto operator<<(int64_t msg) -> LoggerOutputStream &;
......
......@@ -63,6 +63,18 @@ private:
LoggerOutputStream::LoggerOutputStream(std::string channel, int level)
: channel(std::move(channel)), level(level) {}
auto LoggerOutputStream::operator<<(std::ostream &(*f)(std::ostream &)) -> LoggerOutputStream & {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), this->channel, this->level) << f;
return *this;
}
auto LoggerOutputStream::operator<<(bool msg) -> LoggerOutputStream & {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), this->channel, this->level) << msg;
return *this;
}
auto LoggerOutputStream::operator<<(std::streambuf *msg) -> LoggerOutputStream & {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << msg;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment