2026-01-28 06:16:04 +00:00

39 lines
879 B
C++

/**
* \brief A singleton Logger for Inferencers
* \author Nan Zhou, nanzhou at kneron dot us
* \copyright 2019 Kneron Inc. All right reserved.
*/
#ifndef PIANO_DYNASTY_INCLUDE_LOG_INFERENCELOGGER_H_
#define PIANO_DYNASTY_INCLUDE_LOG_INFERENCELOGGER_H_
#include <memory>
#include <mutex>
#include "spdlog/spdlog.h"
#ifdef PROFILE_NODES
#include "profc.h"
#define SMART_PROFILE(node_name) PROFC_NODE(node_name)
#else
#define SMART_PROFILE(node_name) {}
#endif
namespace dynasty {
namespace log {
class InferenceLogger {
private:
static std::shared_ptr<spdlog::logger> logger_instance_;
static std::mutex mutex_;
InferenceLogger();
public:
static std::shared_ptr<spdlog::logger> GetLogger();
static void SetLogLevel(spdlog::level::level_enum llevel=spdlog::level::level_enum::err);
};
}
}
#endif //PIANO_DYNASTY_INCLUDE_LOG_INFERENCELOGGER_H_