Skip to content
Snippets Groups Projects
Commit 22f0de69 authored by Joscha Schmiedt's avatar Joscha Schmiedt
Browse files

Add missing LoggerOutputStream operator<< for std::filesystem::path (issue #75)

parent 24a0ee68
Branches
Tags
2 merge requests!61Release 0.3.0,!48Fix compilation errors on Windows
...@@ -30,6 +30,10 @@ ...@@ -30,6 +30,10 @@
#include <string> // for string #include <string> // for string
#include <vector> // for vector #include <vector> // for vector
namespace std::filesystem {
class path;
}
namespace caosdb::logging { namespace caosdb::logging {
const std::string logger_name = "caosdb::logging"; const std::string logger_name = "caosdb::logging";
...@@ -46,6 +50,9 @@ public: ...@@ -46,6 +50,9 @@ public:
auto operator<<(const char *msg) -> LoggerOutputStream &; auto operator<<(const char *msg) -> LoggerOutputStream &;
auto operator<<(const std::string &msg) -> LoggerOutputStream &; auto operator<<(const std::string &msg) -> LoggerOutputStream &;
auto operator<<(void *msg) -> LoggerOutputStream &; auto operator<<(void *msg) -> LoggerOutputStream &;
auto operator<<(std::filesystem::path *path) -> LoggerOutputStream &;
LoggerOutputStream &operator<<(const std::filesystem::path &path);
static auto get(const std::string &channel, int level) -> LoggerOutputStream { static auto get(const std::string &channel, int level) -> LoggerOutputStream {
return LoggerOutputStream(channel, level); return LoggerOutputStream(channel, level);
} }
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "caosdb/protobuf_helper.h" // for get_arena #include "caosdb/protobuf_helper.h" // for get_arena
#include "caosdb/value.h" // for Value #include "caosdb/value.h" // for Value
#include <google/protobuf/arena.h> // for Arena #include <google/protobuf/arena.h> // for Arena
#include <string>
namespace caosdb::entity { namespace caosdb::entity {
using ProtoParent = caosdb::entity::v1::Parent; using ProtoParent = caosdb::entity::v1::Parent;
......
...@@ -39,6 +39,7 @@ ...@@ -39,6 +39,7 @@
#include <boost/smart_ptr/intrusive_ref_counter.hpp> #include <boost/smart_ptr/intrusive_ref_counter.hpp>
#include <boost/smart_ptr/shared_ptr.hpp> #include <boost/smart_ptr/shared_ptr.hpp>
#include <cstdint> // for uint64_t #include <cstdint> // for uint64_t
#include <filesystem>
#include <memory> #include <memory>
#include <sstream> #include <sstream>
#include <string> #include <string>
...@@ -117,6 +118,18 @@ auto LoggerOutputStream::operator<<(void *msg) -> LoggerOutputStream & { ...@@ -117,6 +118,18 @@ auto LoggerOutputStream::operator<<(void *msg) -> LoggerOutputStream & {
return *this; return *this;
} }
auto LoggerOutputStream::operator<<(std::filesystem::path *path) -> LoggerOutputStream & {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << path->string();
return *this;
}
LoggerOutputStream &LoggerOutputStream::operator<<(const std::filesystem::path &path) {
BOOST_LOG_CHANNEL_SEV(caosdb::logging::logger::get(), channel, this->level) << path.string();
return *this;
}
LoggingConfiguration::LoggingConfiguration(int level) : LevelConfiguration(level) {} LoggingConfiguration::LoggingConfiguration(int level) : LevelConfiguration(level) {}
auto LoggingConfiguration::AddSink(const std::shared_ptr<SinkConfiguration> &sink) -> void { auto LoggingConfiguration::AddSink(const std::shared_ptr<SinkConfiguration> &sink) -> void {
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include "caosdb/result_set.h" // for ResultSet #include "caosdb/result_set.h" // for ResultSet
#include <memory> // for unique_ptr #include <memory> // for unique_ptr
#include <utility> // for move, pair #include <utility> // for move, pair
#include <vector>
namespace caosdb::transaction { namespace caosdb::transaction {
......
...@@ -40,6 +40,7 @@ ...@@ -40,6 +40,7 @@
#include <map> // for map, operator!= #include <map> // for map, operator!=
#include <memory> // for unique_ptr #include <memory> // for unique_ptr
#include <random> // for mt19937, rand... #include <random> // for mt19937, rand...
#include <string> // for string
#include <system_error> // for std::system_error #include <system_error> // for std::system_error
#include <utility> // for move, pair #include <utility> // for move, pair
// IWYU pragma: no_include <cxxabi.h> // IWYU pragma: no_include <cxxabi.h>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment