YACLib
C++ library for concurrent tasks execution
Loading...
Searching...
No Matches
log.cpp
Go to the documentation of this file.
1#include <yaclib/log.hpp>
2
3#include <array>
4#include <cstddef>
5
6namespace yaclib::detail {
7
8static std::array<LogCallback, static_cast<std::size_t>(LogLevel::Count)> sCallbacks = {};
9
10void LogMessage(LogLevel level, std::string_view file, std::size_t line, std::string_view func,
11 std::string_view condition, std::string_view message) noexcept {
12 if (const auto callback = sCallbacks[static_cast<std::size_t>(level)]; callback != nullptr) {
14 }
15}
16
18 sCallbacks[static_cast<std::size_t>(level)] = std::move(callback);
19}
20
21} // namespace yaclib::detail
auto SetCallback(ResultCorePtr< Arg, E > &core, IExecutor *executor, Func &&f)
Definition core.hpp:304
void LogMessage(LogLevel level, std::string_view file, std::size_t line, std::string_view func, std::string_view condition, std::string_view message) noexcept
Definition log.cpp:10
static std::array< LogCallback, static_cast< std::size_t >(LogLevel::Count)> sCallbacks
Definition log.cpp:8
Contract< V, E > MakeContract()
Creates related future and promise.
Definition contract.hpp:25
void(*)(std::string_view file, std::size_t line, std::string_view function, std::string_view condition, std::string_view message) noexcept LogCallback
Definition log.hpp:10