1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

plugin: add support for spdlog custom formatter

This commit is contained in:
Steffen Vogel 2021-07-07 10:36:38 +02:00
parent 6062610a63
commit 3ae2285ea4

View file

@ -28,6 +28,7 @@
#include <list>
#include <string>
#include <jansson.h>
#include <spdlog/fmt/ostr.h>
#include <villas/log.hpp>
#include <villas/common.hpp>
@ -139,6 +140,13 @@ public:
virtual std::string
getDescription() const = 0;
/** Custom formatter for spdlog */
template<typename OStream>
friend OStream &operator<<(OStream &os, const class Plugin &p)
{
return os << p.getName();
}
protected:
std::string path;
@ -160,7 +168,7 @@ Registry::dumpList()
for (Plugin *p : *plugins) {
T *t = dynamic_cast<T *>(p);
if (t)
getLogger()->info(" - {}: {}", p->getName(), p->getDescription());
getLogger()->info(" - {}: {}", *p, p->getDescription());
}
}