EICrecon
JANA based reconstruction for the EPIC detector
Loading...
Searching...
No Matches
/home/runner/work/EICrecon/EICrecon/src/extensions/spdlog/SpdlogMixin.h

Initializes logger through current LogService

Parameters
app- JApplication pointer, as obtained from GetApplication()
param_prefix- name of both logger and user parameter
default_level- optional - default log level, overrides default logging level : trace, debug, info, warn, err, critical, off
Remarks
: Each logger is cloned from spdlog::default_logger(). This allows to set the default level and output formatting on a global system level. But sometimes it is useful to provide default log level independently on what is set by the system. Again we are about DEFAULT value if no user flag is provided

InitLogger(GetApplication(), "BTRK:TrackerHits") // Default log level is set the same as in system InitLogger(GetApplication(), "BTRK:TrackerHits", "info") // By default log level is info

will create "BTRK:TrackerHits" logger and check -PBTRK:TrackerHits:LogLevel user parameter

// Created by Dmitry Romanov
// Subject to the terms in the LICENSE file found in the top-level directory.
//
#pragma once
#include <memory>
#include <spdlog/spdlog.h>
#include <JANA/JApplicationFwd.h>
namespace eicrecon {
class SpdlogMixin {
public:
void InitLogger(JApplication* app, const std::string& param_prefix,
const level default_level = level::info) {
// Logger. Get plugin level sub-log
m_log = app->GetService<Log_service>()->logger(param_prefix, default_level);
}
public:
std::shared_ptr<spdlog::logger>& logger() { return m_log; }
protected: // FIXME change to private
std::shared_ptr<spdlog::logger> m_log;
};
} // namespace eicrecon
Definition Log_service.h:15
spdlog::level::level_enum level
Definition Log_service.h:17
Log_service::level level
Definition SpdlogMixin.h:33
std::shared_ptr< spdlog::logger > m_log
current logger
Definition SpdlogMixin.h:65
std::shared_ptr< spdlog::logger > & logger()
Definition SpdlogMixin.h:61
void InitLogger(JApplication *app, const std::string &param_prefix, const level default_level=level::info)
Definition SpdlogMixin.h:53
-client
Definition CalorimeterClusterRecoCoG.cc:37