continue v2 error implementations
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
Some checks reported errors
BlockStorage/repertory/pipeline/head Something is wrong with the build of this commit
This commit is contained in:
parent
06b79ffd2d
commit
d5e0252ed3
68
repertory/librepertory/include/events/types/info_log.hpp
Normal file
68
repertory/librepertory/include/events/types/info_log.hpp
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright <2018-2025> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_INFO_LOG_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_INFO_LOG_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct info_log final : public i_event {
|
||||
info_log() = default;
|
||||
info_log(std::string_view function_name_, std::string msg_)
|
||||
: function_name(std::string(function_name_)), msg(std::move(msg_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::info};
|
||||
static constexpr const std::string_view name{"info_log"};
|
||||
|
||||
std::string function_name;
|
||||
std::string msg;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
return name;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_single_line() const -> std::string override {
|
||||
return fmt::format("{}|func|{}|msg|{}", name, function_name, msg);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::info_log> {
|
||||
static void to_json(json &data, const repertory::info_log &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["msg"] = value.msg;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::info_log &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("msg").get_to<std::string>(value.msg);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_INFO_LOG_HPP_
|
68
repertory/librepertory/include/events/types/trace_log.hpp
Normal file
68
repertory/librepertory/include/events/types/trace_log.hpp
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright <2018-2025> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_TRACE_LOG_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_TRACE_LOG_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct trace_log final : public i_event {
|
||||
trace_log() = default;
|
||||
trace_log(std::string_view function_name_, std::string msg_)
|
||||
: function_name(std::string(function_name_)), msg(std::move(msg_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::trace};
|
||||
static constexpr const std::string_view name{"trace_log"};
|
||||
|
||||
std::string function_name;
|
||||
std::string msg;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
return name;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_single_line() const -> std::string override {
|
||||
return fmt::format("{}|func|{}|msg|{}", name, function_name, msg);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::trace_log> {
|
||||
static void to_json(json &data, const repertory::trace_log &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["msg"] = value.msg;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::trace_log &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("msg").get_to<std::string>(value.msg);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_TRACE_LOG_HPP_
|
68
repertory/librepertory/include/events/types/warn_log.hpp
Normal file
68
repertory/librepertory/include/events/types/warn_log.hpp
Normal file
@ -0,0 +1,68 @@
|
||||
/*
|
||||
Copyright <2018-2025> <scott.e.graves@protonmail.com>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
*/
|
||||
#ifndef REPERTORY_INCLUDE_EVENTS_TYPES_WARN_LOG_HPP_
|
||||
#define REPERTORY_INCLUDE_EVENTS_TYPES_WARN_LOG_HPP_
|
||||
|
||||
#include "events/i_event.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
|
||||
namespace repertory {
|
||||
struct warn_log final : public i_event {
|
||||
warn_log() = default;
|
||||
warn_log(std::string_view function_name_, std::string msg_)
|
||||
: function_name(std::string(function_name_)), msg(std::move(msg_)) {}
|
||||
|
||||
static constexpr const event_level level{event_level::warn};
|
||||
static constexpr const std::string_view name{"warn_log"};
|
||||
|
||||
std::string function_name;
|
||||
std::string msg;
|
||||
|
||||
[[nodiscard]] auto get_event_level() const -> event_level override {
|
||||
return level;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_name() const -> std::string_view override {
|
||||
return name;
|
||||
}
|
||||
|
||||
[[nodiscard]] auto get_single_line() const -> std::string override {
|
||||
return fmt::format("{}|func|{}|msg|{}", name, function_name, msg);
|
||||
}
|
||||
};
|
||||
} // namespace repertory
|
||||
|
||||
NLOHMANN_JSON_NAMESPACE_BEGIN
|
||||
template <> struct adl_serializer<repertory::warn_log> {
|
||||
static void to_json(json &data, const repertory::warn_log &value) {
|
||||
data["function_name"] = value.function_name;
|
||||
data["msg"] = value.msg;
|
||||
}
|
||||
|
||||
static void from_json(const json &data, repertory::warn_log &value) {
|
||||
data.at("function_name").get_to<std::string>(value.function_name);
|
||||
data.at("msg").get_to<std::string>(value.msg);
|
||||
}
|
||||
};
|
||||
NLOHMANN_JSON_NAMESPACE_END
|
||||
|
||||
#endif // REPERTORY_INCLUDE_EVENTS_TYPES_WARN_LOG_HPP_
|
@ -23,7 +23,10 @@
|
||||
|
||||
#include "events/event_system.hpp"
|
||||
#include "events/types/debug_log.hpp"
|
||||
#include "events/types/info_log.hpp"
|
||||
#include "events/types/repertory_exception.hpp"
|
||||
#include "events/types/trace_log.hpp"
|
||||
#include "events/types/warn_log.hpp"
|
||||
#include "types/repertory.hpp"
|
||||
#include "utils/error.hpp"
|
||||
|
||||
@ -52,19 +55,19 @@ struct repertory_exception_handler final
|
||||
|
||||
void handle_info(std::string_view function_name,
|
||||
std::string_view msg) const override {
|
||||
repertory::event_system::instance().raise<repertory::debug_log>(
|
||||
repertory::event_system::instance().raise<repertory::info_log>(
|
||||
function_name, std::string{msg});
|
||||
}
|
||||
|
||||
void handle_trace(std::string_view function_name,
|
||||
std::string_view msg) const override {
|
||||
repertory::event_system::instance().raise<repertory::debug_log>(
|
||||
repertory::event_system::instance().raise<repertory::trace_log>(
|
||||
function_name, std::string{msg});
|
||||
}
|
||||
|
||||
void handle_warn(std::string_view function_name,
|
||||
std::string_view msg) const override {
|
||||
repertory::event_system::instance().raise<repertory::debug_log>(
|
||||
repertory::event_system::instance().raise<repertory::warn_log>(
|
||||
function_name, std::string{msg});
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user