cserver/examples/src/log.cpp

24 lines
599 B
C++
Raw Normal View History

2024-07-02 16:28:32 +00:00
#include <cserver/components/loggable_component_base.hpp>
struct SomeComponent : cserver::ComponentBase {
static constexpr utempl::ConstexprString kName = "component";
using cserver::ComponentBase::ComponentBase;
constexpr auto Run() -> void {
LOG_DEBUG<"Hello {}">("world!");
};
};
auto main() -> int {
cserver::ServiceContextBuilder{}
.AppendConfigParam<"threads", 8>()
.AppendConfigParam<"logging", cserver::ConstexprConfig{}
.Append<"level">(cserver::LoggingLevel::kTrace)>()
.Append<cserver::Logging>()
.Append<SomeComponent>()
.Sort()
.Run();
};