File indexing completed on 2025-01-18 09:55:45
0001 #pragma once
0002
0003
0004 #include <JANA/JApplication.h>
0005 #include <JANA/Services/JServiceLocator.h>
0006 #include <spdlog/common.h>
0007 #include <spdlog/logger.h>
0008 #include <memory>
0009 #include <mutex>
0010 #include <optional>
0011 #include <string>
0012
0013
0014
0015
0016 class Log_service : public JService
0017 {
0018 public:
0019 using level = spdlog::level::level_enum;
0020
0021 public:
0022 explicit Log_service(JApplication *app);
0023 ~Log_service();
0024
0025
0026
0027 virtual std::shared_ptr<spdlog::logger> logger(
0028 const std::string &name,
0029 const std::optional<level> default_level = std::nullopt);
0030
0031
0032
0033 virtual level getDefaultLevel();
0034
0035
0036 virtual std::string getDefaultLevelStr();
0037
0038 private:
0039
0040 Log_service()=default;
0041
0042 std::recursive_mutex m_lock;
0043 JApplication* m_application;
0044 std::string m_log_level_str;
0045 std::string m_log_format_str;
0046 };