spdlog.cpp 5.87 KB
Newer Older
gabime's avatar
gabime committed
1
// Copyright(c) 2015-present, Gabi Melman & spdlog contributors.
gabime's avatar
gabime committed
2
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
3

4 5
#ifndef SPDLOG_COMPILED_LIB
#error Please define SPDLOG_COMPILED_LIB to compile this file.
6
#endif
gabime's avatar
gabime committed
7

gabime's avatar
gabime committed
8
#include <mutex>
9
#include <chrono>
gabime's avatar
gabime committed
10

gabime's avatar
gabime committed
11
#include "spdlog/details/null_mutex.h"
gabime's avatar
gabime committed
12
#include "spdlog/async.h"
13

gabime's avatar
gabime committed
14
#include "spdlog/spdlog-inl.h"
gabime's avatar
gabime committed
15 16
#include "spdlog/common-inl.h"

gabime's avatar
gabime committed
17
#include "spdlog/logger-inl.h"
gabime's avatar
gabime committed
18
template spdlog::logger::logger(std::string name, sinks_init_list::iterator begin, sinks_init_list::iterator end);
gabime's avatar
gabime committed
19 20 21 22 23 24 25 26 27

#include "spdlog/async_logger-inl.h"
#include "spdlog/details/log_msg-inl.h"
#include "spdlog/sinks/sink-inl.h"

#include "spdlog/sinks/base_sink-inl.h"
template class spdlog::sinks::base_sink<std::mutex>;
template class spdlog::sinks::base_sink<spdlog::details::null_mutex>;

gabime's avatar
gabime committed
28 29 30 31
#include "spdlog/sinks/basic_file_sink-inl.h"
template class spdlog::sinks::basic_file_sink<std::mutex>;
template class spdlog::sinks::basic_file_sink<spdlog::details::null_mutex>;

32 33 34 35
#include "spdlog/sinks/rotating_file_sink-inl.h"
template class spdlog::sinks::rotating_file_sink<std::mutex>;
template class spdlog::sinks::rotating_file_sink<spdlog::details::null_mutex>;

gabime's avatar
gabime committed
36 37 38 39 40 41 42 43 44 45
#include "spdlog/details/registry-inl.h"

#include "spdlog/details/os-inl.h"
#include "spdlog/details/periodic_worker-inl.h"
#include "spdlog/details/file_helper-inl.h"
#include "spdlog/details/pattern_formatter-inl.h"

#include "spdlog/details/thread_pool-inl.h"
template class spdlog::details::mpmc_blocking_queue<spdlog::details::async_msg>;

gabime's avatar
gabime committed
46 47 48
//
// color sinks
//
gabime's avatar
gabime committed
49
#ifdef _WIN32
50
#include "spdlog/sinks/wincolor_sink-inl.h"
51 52
template class spdlog::sinks::wincolor_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::wincolor_sink<spdlog::details::console_nullmutex>;
gabime's avatar
gabime committed
53 54 55 56
template class spdlog::sinks::wincolor_stdout_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::wincolor_stdout_sink<spdlog::details::console_nullmutex>;
template class spdlog::sinks::wincolor_stderr_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::wincolor_stderr_sink<spdlog::details::console_nullmutex>;
gabime's avatar
gabime committed
57 58
#else
#include "spdlog/sinks/ansicolor_sink-inl.h"
59 60
template class spdlog::sinks::ansicolor_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::ansicolor_sink<spdlog::details::console_nullmutex>;
gabime's avatar
gabime committed
61 62 63 64
template class spdlog::sinks::ansicolor_stdout_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::ansicolor_stdout_sink<spdlog::details::console_nullmutex>;
template class spdlog::sinks::ansicolor_stderr_sink<spdlog::details::console_mutex>;
template class spdlog::sinks::ansicolor_stderr_sink<spdlog::details::console_nullmutex>;
65 66
#endif

gabime's avatar
gabime committed
67
// factory methods for color loggers
gabime's avatar
gabime committed
68
#include "spdlog/sinks/stdout_color_sinks-inl.h"
gabime's avatar
gabime committed
69 70 71 72 73 74 75 76
template std::shared_ptr<spdlog::logger> spdlog::stdout_color_mt<spdlog::synchronous_factory>(
    const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stdout_color_st<spdlog::synchronous_factory>(
    const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stderr_color_mt<spdlog::synchronous_factory>(
    const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::synchronous_factory>(
    const std::string &logger_name, color_mode mode);
gabime's avatar
gabime committed
77 78 79 80 81

template std::shared_ptr<spdlog::logger> spdlog::stdout_color_mt<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stdout_color_st<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stderr_color_mt<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
82

83
// Slightly modified version of fmt lib's format.cc source file.
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
// Copyright (c) 2012 - 2016, Victor Zverovich
// All rights reserved.

#if !defined(SPDLOG_FMT_EXTERNAL)
#include "spdlog/fmt/bundled/format-inl.h"

FMT_BEGIN_NAMESPACE
template struct internal::basic_data<void>;
template FMT_API internal::locale_ref::locale_ref(const std::locale &loc);
template FMT_API std::locale internal::locale_ref::get<std::locale>() const;

// Explicit instantiations for char.
template FMT_API char internal::thousands_sep_impl(locale_ref);
template FMT_API void internal::basic_buffer<char>::append(const char *, const char *);
template FMT_API void internal::arg_map<format_context>::init(const basic_format_args<format_context> &args);
template FMT_API int internal::char_traits<char>::format_float(char *, std::size_t, const char *, int, double);
template FMT_API int internal::char_traits<char>::format_float(char *, std::size_t, const char *, int, long double);
template FMT_API std::string internal::vformat<char>(string_view, basic_format_args<format_context>);
template FMT_API format_context::iterator internal::vformat_to(internal::buffer &, string_view, basic_format_args<format_context>);
gabime's avatar
gabime committed
103 104
template FMT_API void internal::sprintf_format(double, internal::buffer &, core_format_specs);
template FMT_API void internal::sprintf_format(long double, internal::buffer &, core_format_specs);
105 106 107 108 109 110 111 112 113

// Explicit instantiations for wchar_t.
template FMT_API wchar_t internal::thousands_sep_impl(locale_ref);
template FMT_API void internal::basic_buffer<wchar_t>::append(const wchar_t *, const wchar_t *);
template FMT_API void internal::arg_map<wformat_context>::init(const basic_format_args<wformat_context> &);
template FMT_API int internal::char_traits<wchar_t>::format_float(wchar_t *, std::size_t, const wchar_t *, int, double);
template FMT_API int internal::char_traits<wchar_t>::format_float(wchar_t *, std::size_t, const wchar_t *, int, long double);
template FMT_API std::wstring internal::vformat<wchar_t>(wstring_view, basic_format_args<wformat_context>);
FMT_END_NAMESPACE
114

115
#endif