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