Added default logger API

This commit is contained in:
gabime
2018-10-12 03:04:55 +03:00
parent 8e4996baf4
commit b368d18b0f
29 changed files with 406 additions and 119 deletions

View File

@@ -5,6 +5,10 @@
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#include "spdlog/details/fmt_helper.h"
#include "spdlog/details/null_mutex.h"
#include "spdlog/details/os.h"

View File

@@ -5,6 +5,10 @@
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#include "spdlog/details/console_globals.h"
#include "spdlog/details/null_mutex.h"
#include "spdlog/details/os.h"

View File

@@ -4,10 +4,14 @@
//
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#include "spdlog/details/file_helper.h"
#include "spdlog/details/null_mutex.h"
#include "spdlog/sinks/base_sink.h"
#include "spdlog/spdlog.h"
#include <mutex>
#include <string>

View File

@@ -4,11 +4,15 @@
//
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#include "spdlog/details/file_helper.h"
#include "spdlog/details/null_mutex.h"
#include "spdlog/fmt/fmt.h"
#include "spdlog/sinks/base_sink.h"
#include "spdlog/spdlog.h"
#include <chrono>
#include <cstdio>

View File

@@ -5,6 +5,10 @@
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#include "base_sink.h"
#include "spdlog/details/log_msg.h"
#include "spdlog/details/null_mutex.h"

View File

@@ -5,6 +5,10 @@
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#if defined(_WIN32)
#include "spdlog/details/null_mutex.h"

View File

@@ -5,6 +5,10 @@
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#include "spdlog/details/null_mutex.h"
#include "spdlog/sinks/base_sink.h"
@@ -25,4 +29,17 @@ using null_sink_mt = null_sink<std::mutex>;
using null_sink_st = null_sink<details::null_mutex>;
} // namespace sinks
template<typename Factory = default_factory>
inline std::shared_ptr<logger> null_logger_mt(const std::string &logger_name)
{
return Factory::template create<sinks::null_sink_mt>(logger_name);
}
template<typename Factory = default_factory>
inline std::shared_ptr<logger> null_logger_st(const std::string &logger_name)
{
return Factory::template create<sinks::null_sink_st>(logger_name);
}
} // namespace spdlog

View File

@@ -5,6 +5,10 @@
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#include "spdlog/details/null_mutex.h"
#include "spdlog/sinks/base_sink.h"

View File

@@ -4,11 +4,15 @@
//
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#include "spdlog/details/file_helper.h"
#include "spdlog/details/null_mutex.h"
#include "spdlog/fmt/fmt.h"
#include "spdlog/sinks/base_sink.h"
#include "spdlog/spdlog.h"
#include <cerrno>
#include <chrono>

View File

@@ -5,7 +5,10 @@
#pragma once
#include "spdlog/spdlog.h"
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#ifdef _WIN32
#include "spdlog/sinks/wincolor_sink.h"
#else

View File

@@ -5,9 +5,12 @@
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#include "spdlog/details/console_globals.h"
#include "spdlog/details/null_mutex.h"
#include "spdlog/spdlog.h"
#include <cstdio>
#include <memory>

View File

@@ -5,8 +5,11 @@
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#include "spdlog/sinks/base_sink.h"
#include "spdlog/spdlog.h"
#include <array>
#include <string>

View File

@@ -5,6 +5,10 @@
#pragma once
#ifndef SPDLOG_H
#error "spdlog.h must be included before this file."
#endif
#include "spdlog/common.h"
#include "spdlog/details/console_globals.h"
#include "spdlog/details/null_mutex.h"