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

refactor: use of auto

parent 0f2040e7
......@@ -47,8 +47,8 @@ extern Log logging;
class Log {
public:
using DistSink = std::shared_ptr<spdlog::sinks::dist_sink_mt>;
using Level = spdlog::level::level_enum;
using DistSink = spdlog::sinks::dist_sink_mt;
protected:
Logger logger = logging.get("log");
......
......@@ -42,7 +42,7 @@ namespace villas {
namespace kernel {
namespace rt {
static auto logger = logging.get("kernel:rt");
static Logger logger = logging.get("kernel:rt");
int init(int priority, int affinity)
{
......
......@@ -46,7 +46,7 @@
using namespace villas;
static auto logger = logging.get("kernel:vfio");
static Logger logger = logging.get("kernel:vfio");
static const char *vfio_pci_region_names[] = {
"PCI_BAR0", // VFIO_PCI_BAR0_REGION_INDEX,
......
......@@ -62,7 +62,7 @@ int Log::getWidth()
Logger Log::get(const std::string &name)
{
auto logger = spdlog::get(name);
Logger logger = spdlog::get(name);
if (not logger)
logger = std::make_shared<Logger::element_type>(name, sinks);
......@@ -98,13 +98,13 @@ void Log::parse(json_t *cfg)
if (path) {
auto sink = std::make_shared<spdlog::sinks::basic_file_sink_mt>(path);
sinks->add_sink(sink);
sinks.add_sink(sink);
}
if (syslog) {
auto sink = std::make_shared<spdlog::sinks::syslog_sink_mt>("villas", LOG_PID, LOG_DAEMON);
sinks->add_sink(sink);
sinks.add_sink(sink);
}
if (json_expressions) {
......@@ -124,7 +124,7 @@ void Log::parse(json_t *cfg)
if (ret)
throw new JsonError(err);
auto logger = get(name);
Logger logger = get(name);
auto level = spdlog::level::from_str(lvl);
logger->set_level(level);
......
......@@ -29,7 +29,7 @@
using namespace villas;
auto logger = logging.get("default");
Logger logger = logging.get("default");
int log_get_width()
{
......
......@@ -189,7 +189,7 @@ MemoryTranslation::getForeignAddr(uintptr_t addrInLocalAddrSpace) const
MemoryTranslation&
MemoryTranslation::operator+=(const MemoryTranslation& other)
{
auto logger = logging.get("MemoryTranslation");
Logger logger = logging.get("MemoryTranslation");
// set level to debug to enable debug output
logger->set_level(spdlog::level::info);
......
......@@ -96,7 +96,7 @@ Plugin::unload()
void
Plugin::dump()
{
auto logger = Registry::getLogger();
Logger logger = Registry::getLogger();
logger->info("Name: '{}' Description: '{}'", name, description);
}
......
......@@ -69,7 +69,7 @@ void Terminal::resize(int, siginfo_t *, void *)
if (ret)
throw new SystemError("Failed to get terminal dimensions");
auto logger = logging.get("terminal");
Logger logger = logging.get("terminal");
logger->debug("New terminal size: {}x{}", window.ws_row, window.ws_col);
};
......@@ -101,7 +101,7 @@ int signals_init(void (*cb)(int signal, siginfo_t *sinfo, void *ctx))
{
int ret;
auto logger = logging.get("signals");
Logger logger = logging.get("signals");
logger->info("Initialize subsystem");
......
......@@ -33,7 +33,7 @@ TestSuite(graph, .description = "Graph library");
Test(graph, basic, .description = "DirectedGraph")
{
auto logger = logging.get("test:graph:basic");
Logger logger = logging.get("test:graph:basic");
villas::graph::DirectedGraph<> g("test:graph:basic");
logger->info("Testing basic graph construction and modification");
......@@ -64,7 +64,7 @@ Test(graph, basic, .description = "DirectedGraph")
Test(graph, path, .description = "Find path")
{
auto logger = logging.get("test:graph:path");
Logger logger = logging.get("test:graph:path");
logger->info("Testing path finding algorithm");
using Graph = villas::graph::DirectedGraph<>;
......@@ -128,7 +128,7 @@ Test(graph, path, .description = "Find path")
Test(graph, memory_manager, .description = "Global Memory Manager")
{
auto logger = logging.get("test:graph:mm");
Logger logger = logging.get("test:graph:mm");
auto& mm = villas::MemoryManager::get();
logger->info("Create address spaces");
......
......@@ -58,7 +58,7 @@ static int format_msg(char *buf, size_t buflen, const char *msg, va_list args)
void criterion_log_noformat(enum criterion_severity severity, const char *msg)
{
auto logger = logging.get("criterion");
Logger logger = logging.get("criterion");
switch (severity) {
case CR_LOG_WARNING:
......@@ -84,7 +84,7 @@ void criterion_vlog(enum criterion_logging_level /* level */, const char *msg, v
format_msg(formatted_msg, sizeof(formatted_msg), msg, args);
auto logger = logging.get("test");
Logger logger = logging.get("test");
logger->info(formatted_msg);
}
......@@ -101,7 +101,7 @@ void criterion_plog(enum criterion_logging_level /* level */, const struct crite
format_msg(formatted_msg, sizeof(formatted_msg), msg, args);
va_end(args);
auto logger = logging.get("test");
Logger logger = logging.get("test");
if (!strcmp(prefix->prefix, "----") && !strcmp(prefix->color, "\33[0;34m"))
logger->info(formatted_msg);
......
Supports Markdown
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