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:
parent
6062610a63
commit
3ae2285ea4
1 changed files with 9 additions and 1 deletions
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue