diff --git a/include/caosdb/logging.h b/include/caosdb/logging.h index 3fda8e83ac5c164728b2cd156292d22952b70130..d17c8916e73471c33f3f1abf9ecac3b149b77aea 100644 --- a/include/caosdb/logging.h +++ b/include/caosdb/logging.h @@ -30,6 +30,10 @@ #include <string> // for string #include <vector> // for vector +namespace std::filesystem { +class path; +} + namespace caosdb::logging { const std::string logger_name = "caosdb::logging"; @@ -46,6 +50,9 @@ public: auto operator<<(const char *msg) -> LoggerOutputStream &; auto operator<<(const std::string &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 { return LoggerOutputStream(channel, level); } diff --git a/include/caosdb/transaction_status.h b/include/caosdb/transaction_status.h index d46f3911aa17fbf518fd43b91e3568e4e4740c2f..56bd55be6c0af5adda94fff6f49bd6781ad50816 100644 --- a/include/caosdb/transaction_status.h +++ b/include/caosdb/transaction_status.h @@ -40,7 +40,7 @@ using caosdb::exceptions::TransactionTypeError; * Define static factory method in the TransactionStatus class. */ #define CAOSDB_TRANSACTION_STATUS_DEFAULT_FACTORY(_StatusName, _StatusCode) \ - inline static auto _StatusName()->const TransactionStatus & { \ + inline static auto _StatusName() -> const TransactionStatus & { \ static const TransactionStatus instance(_StatusCode, \ caosdb::get_status_description(_StatusCode)); \ return instance; \ diff --git a/src/caosdb/configuration.cpp b/src/caosdb/configuration.cpp index e1ffb23b3b1a2db5ecea79588c237bb36e79b1e1..8fbf9fed79eba523784fa78468b1b889d6c9ca31 100644 --- a/src/caosdb/configuration.cpp +++ b/src/caosdb/configuration.cpp @@ -55,7 +55,7 @@ throw ConfigurationError("This CaosDB client has not been configured."); \ } \ assert(WRAPPED_JSON_CONFIGURATION(this)->is_object()); \ - const auto &configuration = WRAPPED_JSON_CONFIGURATION(this)->as_object(); \ + const auto &configuration = WRAPPED_JSON_CONFIGURATION(this) -> as_object(); \ if (!configuration.contains("connections")) { \ throw ConfigurationError("This CaosDB client hasn't any configured connections."); \ } \ diff --git a/src/caosdb/entity.cpp b/src/caosdb/entity.cpp index 568cc5d97c38c8af0bf8fd632d93cb9b9bc4b2f1..c8bcb486d6f34db98d8cbe993a74e9bac096d672 100644 --- a/src/caosdb/entity.cpp +++ b/src/caosdb/entity.cpp @@ -25,6 +25,7 @@ #include "caosdb/protobuf_helper.h" // for get_arena #include "caosdb/value.h" // for Value #include <google/protobuf/arena.h> // for Arena +#include <string> namespace caosdb::entity { using ProtoParent = caosdb::entity::v1::Parent; diff --git a/src/caosdb/logging.cpp b/src/caosdb/logging.cpp index ecc34d668971eaa22cd7ff727d8f54c84c2f3bdc..f6ca7f48600adc67e0ba315105642208c5619987 100644 --- a/src/caosdb/logging.cpp +++ b/src/caosdb/logging.cpp @@ -39,6 +39,7 @@ #include <boost/smart_ptr/intrusive_ref_counter.hpp> #include <boost/smart_ptr/shared_ptr.hpp> #include <cstdint> // for uint64_t +#include <filesystem> #include <memory> #include <sstream> #include <string> @@ -117,6 +118,18 @@ auto LoggerOutputStream::operator<<(void *msg) -> LoggerOutputStream & { 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) {} auto LoggingConfiguration::AddSink(const std::shared_ptr<SinkConfiguration> &sink) -> void { diff --git a/src/caosdb/result_set.cpp b/src/caosdb/result_set.cpp index a4172a836d4e8bb9ed5e568439556ebace53c4e4..f4f4efddbd00edb9de9ce06a9a2225a8b73e0c16 100644 --- a/src/caosdb/result_set.cpp +++ b/src/caosdb/result_set.cpp @@ -20,6 +20,7 @@ #include "caosdb/result_set.h" // for ResultSet #include <memory> // for unique_ptr #include <utility> // for move, pair +#include <vector> namespace caosdb::transaction { diff --git a/src/caosdb/transaction.cpp b/src/caosdb/transaction.cpp index 28f9e35fc1a70083d07c99e7f8a4fabfbe58bc32..56e8e8fc922a380fcdca33d58d91d13f8eb068b9 100644 --- a/src/caosdb/transaction.cpp +++ b/src/caosdb/transaction.cpp @@ -40,6 +40,7 @@ #include <map> // for map, operator!= #include <memory> // for unique_ptr #include <random> // for mt19937, rand... +#include <string> // for string #include <system_error> // for std::system_error #include <utility> // for move, pair // IWYU pragma: no_include <cxxabi.h> diff --git a/src/ccaosdb.cpp b/src/ccaosdb.cpp index ae1a728f62b7cdfb293eb347d1a1966b86bfd3b2..82bcbae2c6eaee34368a871c9a5b7f983e838a2a 100644 --- a/src/ccaosdb.cpp +++ b/src/ccaosdb.cpp @@ -83,7 +83,7 @@ extern "C" { auto *wrapped_entity = WRAPPED_ENTITY_CAST(entity); \ auto *tmp = (char *)malloc(sizeof(char) * wrapped_entity->GetFunction.length() + 1); \ strcpy(tmp, wrapped_entity->GetFunction.c_str()); \ - delete[] * out; \ + delete[] *out; \ *out = tmp; \ return 0; \ }) @@ -109,7 +109,7 @@ extern "C" { auto *wrapped_property = WRAPPED_PROPERTY_CAST(property); \ auto *tmp = (char *)malloc(sizeof(char) * wrapped_property->GetFunction.length() + 1); \ strcpy(tmp, wrapped_property->GetFunction.c_str()); \ - delete[] * out; \ + delete[] *out; \ *out = tmp; \ return 0; \ }) @@ -136,7 +136,7 @@ extern "C" { auto *wrapped_parent = WRAPPED_PARENT_CAST(parent); \ auto *tmp = (char *)malloc(sizeof(char) * wrapped_parent->GetFunction.length() + 1); \ strcpy(tmp, wrapped_parent->GetFunction.c_str()); \ - delete[] * out; \ + delete[] *out; \ *out = tmp; \ return 0; \ }) @@ -729,7 +729,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, std::string role_str = ENUM_NAME_FROM_VALUE(wrapped_entity->GetRole(), Role); auto *tmp = (char *)malloc(sizeof(char) * role_str.length() + 1); strcpy(tmp, role_str.c_str()); - delete[] * out; + delete[] *out; *out = tmp; return 0; }) @@ -741,7 +741,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, auto path = wrapped_entity->GetLocalPath().string(); auto *tmp = (char *)(malloc(sizeof(char) * path.length() + 1)); strcpy(tmp, path.c_str()); - delete[] * out; + delete[] *out; *out = tmp; return 0; }) @@ -887,7 +887,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, ENUM_NAME_FROM_VALUE(wrapped_property->GetImportance(), Importance); char *tmp = (char *)malloc(sizeof(char) * importance_str.length() + 1); strcpy(tmp, importance_str.c_str()); - delete[] * out; + delete[] *out; *out = tmp; return 0; }) @@ -925,7 +925,7 @@ ERROR_RETURN_CODE( auto *wrapped_message = static_cast<caosdb::entity::Message *>(message->wrapped_message); auto *tmp = (char *)malloc(sizeof(char) * wrapped_message->GetDescription().length() + 1); strcpy(tmp, wrapped_message->GetDescription().c_str()); - delete[] * out; + delete[] *out; *out = tmp; return 0; }) @@ -1000,7 +1000,7 @@ ERROR_RETURN_CODE( } char *tmp = (char *)malloc(sizeof(char) * datatype_name.length() + 1); strcpy(tmp, datatype_name.c_str()); - delete[] * out; + delete[] *out; *out = tmp; return 0; }) @@ -1018,7 +1018,7 @@ ERROR_RETURN_CODE(GENERIC_ERROR, auto *tmp = (char *)malloc(sizeof(char) * wrapped_value->GetAsString().length() + 1); strcpy(tmp, wrapped_value->GetAsString().c_str()); - delete[] * out; + delete[] *out; *out = tmp; return 0; })