/** Log sink for OPAL-RTs OpalPrint(). * * @file * @author Steffen Vogel * @copyright 2014-2022, Institute for Automation of Complex Power Systems, EONERC * @license Apache License 2.0 *********************************************************************************/ #pragma once #include #include #include #include namespace villas { namespace node { template class OpalSink : public spdlog::sinks::base_sink { protected: void sink_it_(const spdlog::details::log_msg &msg) override { #ifdef ENABLE_OPAL_ASYNC fmt::memory_buffer formatted; sink::formatter_->format(msg, formatted); auto str = fmt::to_string(formatted).c_str(); OpalPrint(PROJECT_NAME ": %s\n", str); #endif } void flush_() override { /* nothing to do */ } }; using OpalSink_mt = OpalSink; using OpalSink_st = OpalSink; } /* namespace node */ } /* namespace villas */