Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016-2019 CESNET, https://photonics.cesnet.cz/ |
| 3 | * |
| 4 | * Written by Jan Kundrát <jan.kundrat@cesnet.cz> |
| 5 | * |
| 6 | */ |
| 7 | |
| 8 | #include <vector> |
| 9 | #include "utils/log-init.h" |
| 10 | #include "utils/log.h" |
| 11 | |
Tomáš Pecka | 7c6b1d3 | 2020-11-25 14:17:21 +0100 | [diff] [blame] | 12 | namespace velia::utils { |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 13 | |
| 14 | /** @short Initialize logging |
| 15 | |
| 16 | Creates and registers all required loggers and connect them to the provided sink. |
| 17 | */ |
| 18 | void initLogs(std::shared_ptr<spdlog::sinks::sink> sink) |
| 19 | { |
Václav Kubernát | d386aba | 2021-01-19 10:03:28 +0100 | [diff] [blame] | 20 | for (const auto& name : {"main", "health", "hardware", "sysrepo", "system", "firewall"}) { |
Tomáš Pecka | 5123e00 | 2020-06-05 15:29:21 +0200 | [diff] [blame] | 21 | spdlog::register_logger(std::make_shared<spdlog::logger>(name, sink)); |
| 22 | } |
| 23 | } |
| 24 | } |