36 lines
670 B
C++
36 lines
670 B
C++
#ifndef NET_PUB_HPP
|
|
#define NET_PUB_HPP
|
|
|
|
#include <spdlog/sinks/rotating_file_sink.h>
|
|
#include <spdlog/sinks/stdout_color_sinks.h>
|
|
#include <spdlog/spdlog.h>
|
|
|
|
#include <memory>
|
|
#include <mutex>
|
|
|
|
class noncopyable
|
|
{
|
|
protected:
|
|
noncopyable() = default;
|
|
noncopyable(const noncopyable&) = delete;
|
|
noncopyable& operator=(const noncopyable&) = delete;
|
|
};
|
|
|
|
typedef std::shared_ptr<spdlog::logger> Log_t;
|
|
class CLogger : public noncopyable
|
|
{
|
|
public:
|
|
static Log_t getLogger();
|
|
|
|
private:
|
|
void init();
|
|
using CPtrLogger = std::shared_ptr<CLogger>;
|
|
|
|
private:
|
|
static CPtrLogger logger_;
|
|
static std::mutex mutex_;
|
|
static Log_t log_;
|
|
};
|
|
|
|
#endif
|