Commit d818bcab authored by Steffen Vogel's avatar Steffen Vogel 🎅🏼
Browse files

plugin: add support for spdlog custom formatter

parent 574f4467
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <list> #include <list>
#include <string> #include <string>
#include <jansson.h> #include <jansson.h>
#include <spdlog/fmt/ostr.h>
#include <villas/log.hpp> #include <villas/log.hpp>
#include <villas/common.hpp> #include <villas/common.hpp>
...@@ -139,6 +140,13 @@ public: ...@@ -139,6 +140,13 @@ public:
virtual std::string virtual std::string
getDescription() const = 0; getDescription() const = 0;
/** Custom formatter for spdlog */
template<typename OStream>
friend OStream &operator<<(OStream &os, const class Plugin &p)
{
return os << p.getName();
}
protected: protected:
std::string path; std::string path;
...@@ -160,7 +168,7 @@ Registry::dumpList() ...@@ -160,7 +168,7 @@ Registry::dumpList()
for (Plugin *p : *plugins) { for (Plugin *p : *plugins) {
T *t = dynamic_cast<T *>(p); T *t = dynamic_cast<T *>(p);
if (t) if (t)
getLogger()->info(" - {}: {}", p->getName(), p->getDescription()); getLogger()->info(" - {}: {}", *p, p->getDescription());
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment