You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
//
// Created by zhaohe on 19-5-31.
//
#pragma once
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <set>
#include <sstream>
#include <string>
#include <vector>
//
#include "spdlog/spdlog.h"
//
#include "spdlog/sinks/basic_file_sink.h"
#include "spdlog/sinks/daily_file_sink.h"
#include "spdlog/sinks/rotating_file_sink.h"
#include "spdlog/sinks/stdout_color_sinks.h"
namespace iflytop { namespace core { using namespace std; using namespace spdlog; typedef shared_ptr<spdlog::logger> logger_t;
#define ENABLE_LOGGER(loggerName) \
public: \ iflytop::core::logger_t logger = iflytop::core::SpdLoggerFactory::Instance().createLogger(#loggerName); \ \ private:
#define CREATE_LOGGER(loggerName) iflytop::core::SpdLoggerFactory::Instance().createLogger(#loggerName)
#define GET_LOGGER(loggerName) iflytop::core::SpdLoggerFactory::Instance().createLogger(#loggerName)
#define GET_SINK(sinkName) iflytop::core::SpdLoggerFactory::Instance().getSink(sinkName)
class SpdLoggerFactory { SpdLoggerFactory() {}; std::mutex createLogger_lock; atomic_bool initializeLogger = {false}; set<string> s_loggerNames;
public: static SpdLoggerFactory& Instance() { static SpdLoggerFactory factory; return factory; } shared_ptr<logger> createLogger(string loggerName); set<string> loggerNames();
sink_ptr getSink(string name);
private: void parseSphLogConfig(string path); }; } // namespace core
} // namespace iflytop
|