Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
6bcb422c
Commit
6bcb422c
authored
May 11, 2019
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
clang format and SPLDOG_HEADER_ONLY macro
parent
540f8653
Hide whitespace changes
Inline
Side-by-side
Showing
37 changed files
with
232 additions
and
250 deletions
+232
-250
.clang-format
.clang-format
+3
-3
CMakeLists.txt
CMakeLists.txt
+1
-1
example.cpp
example/example.cpp
+10
-4
async_logger-inl.h
include/spdlog/async_logger-inl.h
+3
-6
async_logger.h
include/spdlog/async_logger.h
+1
-1
common-inl.h
include/spdlog/common-inl.h
+35
-5
common.h
include/spdlog/common.h
+10
-29
circular_q.h
include/spdlog/details/circular_q.h
+1
-2
console_globals.h
include/spdlog/details/console_globals.h
+0
-1
file_helper-inl.h
include/spdlog/details/file_helper-inl.h
+1
-0
file_helper.h
include/spdlog/details/file_helper.h
+1
-1
log_msg-inl.h
include/spdlog/details/log_msg-inl.h
+10
-7
log_msg.h
include/spdlog/details/log_msg.h
+1
-2
mpmc_blocking_q.h
include/spdlog/details/mpmc_blocking_q.h
+1
-2
null_mutex.h
include/spdlog/details/null_mutex.h
+1
-2
os.h
include/spdlog/details/os.h
+1
-1
pattern_formatter-inl.h
include/spdlog/details/pattern_formatter-inl.h
+18
-36
pattern_formatter.h
include/spdlog/details/pattern_formatter.h
+4
-7
periodic_worker-inl.h
include/spdlog/details/periodic_worker-inl.h
+7
-3
periodic_worker.h
include/spdlog/details/periodic_worker.h
+1
-1
registry.h
include/spdlog/details/registry.h
+1
-1
thread_pool-inl.h
include/spdlog/details/thread_pool-inl.h
+14
-11
thread_pool.h
include/spdlog/details/thread_pool.h
+5
-7
bin_to_hex.h
include/spdlog/fmt/bin_to_hex.h
+1
-2
fmt.h
include/spdlog/fmt/fmt.h
+1
-1
logger-inl.h
include/spdlog/logger-inl.h
+30
-27
logger.h
include/spdlog/logger.h
+4
-7
android_sink.h
include/spdlog/sinks/android_sink.h
+1
-2
ansicolor_sink.h
include/spdlog/sinks/ansicolor_sink.h
+2
-1
ostream_sink.h
include/spdlog/sinks/ostream_sink.h
+1
-2
sink-inl.h
include/spdlog/sinks/sink-inl.h
+2
-4
sink.h
include/spdlog/sinks/sink.h
+1
-1
stdout_sinks.h
include/spdlog/sinks/stdout_sinks.h
+1
-2
format.cc
src/format.cc
+0
-65
format.cpp
src/format.cpp
+51
-0
spdlog.cpp
src/spdlog.cpp
+6
-1
test_errors.cpp
tests/test_errors.cpp
+1
-2
No files found.
.clang-format
View file @
6bcb422c
...
...
@@ -32,9 +32,9 @@ BraceWrapping:
BeforeCatch: true
BeforeElse: true
IndentBraces: false
SplitEmptyFunction:
tru
e
SplitEmptyRecord:
tru
e
SplitEmptyNamespace:
tru
e
SplitEmptyFunction:
fals
e
SplitEmptyRecord:
fals
e
SplitEmptyNamespace:
fals
e
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Custom
BreakBeforeInheritanceComma: false
...
...
CMakeLists.txt
View file @
6bcb422c
...
...
@@ -60,7 +60,7 @@ message(STATUS "Static lib: " ${SPDLOG_STATIC_LIB})
if
(
SPDLOG_STATIC_LIB
)
add_definitions
(
-DSPDLOG_STATIC_LIB
)
set
(
SRC_BASE
"
${
CMAKE_CURRENT_SOURCE_DIR
}
/src"
)
set
(
SRC_FILES
"
${
SRC_BASE
}
/spdlog.cpp"
"
${
SRC_BASE
}
/format.c
c
"
)
set
(
SRC_FILES
"
${
SRC_BASE
}
/spdlog.cpp"
"
${
SRC_BASE
}
/format.c
pp
"
)
add_library
(
spdlog STATIC
${
SRC_FILES
}
)
target_include_directories
(
spdlog PUBLIC
"$<BUILD_INTERFACE:
${
CMAKE_CURRENT_LIST_DIR
}
/include>"
)
target_link_libraries
(
spdlog -Wl,--as-needed
)
...
...
example/example.cpp
View file @
6bcb422c
...
...
@@ -7,10 +7,15 @@
//
//
#include "spdlog/spdlog.h"
//#include "spdlog/spdlog.h"
#include "spdlog/logger.h"
//#include "spdlog/sinks/stdout_color_sinks.h"
int
main
(
int
,
char
*
[])
{
int
i
=
123
;
spdlog
::
info
(
"HELLO STATIC! {}"
,
i
);
spdlog
::
logger
*
l
=
nullptr
;
const
int
i
=
123
;
l
->
info
(
"HELLO STATIC! {}"
,
i
);
l
->
info
(
"HELLO STATIC! {}"
,
"GABI"
);
l
->
info
(
"HELLO STATIC! {} {}"
,
"GABI"
,
i
);
l
->
warn
(
"HELLO STATIC! {} {}"
,
"GABI"
,
i
);
}
\ No newline at end of file
include/spdlog/async_logger-inl.h
View file @
6bcb422c
...
...
@@ -16,20 +16,17 @@ SPDLOG_INLINE spdlog::async_logger::async_logger(
:
logger
(
std
::
move
(
logger_name
),
begin
,
end
)
,
thread_pool_
(
std
::
move
(
tp
))
,
overflow_policy_
(
overflow_policy
)
{
}
{}
SPDLOG_INLINE
spdlog
::
async_logger
::
async_logger
(
std
::
string
logger_name
,
sinks_init_list
sinks_list
,
std
::
weak_ptr
<
details
::
thread_pool
>
tp
,
async_overflow_policy
overflow_policy
)
:
async_logger
(
std
::
move
(
logger_name
),
sinks_list
.
begin
(),
sinks_list
.
end
(),
std
::
move
(
tp
),
overflow_policy
)
{
}
{}
SPDLOG_INLINE
spdlog
::
async_logger
::
async_logger
(
std
::
string
logger_name
,
sink_ptr
single_sink
,
std
::
weak_ptr
<
details
::
thread_pool
>
tp
,
async_overflow_policy
overflow_policy
)
:
async_logger
(
std
::
move
(
logger_name
),
{
std
::
move
(
single_sink
)},
std
::
move
(
tp
),
overflow_policy
)
{
}
{}
// send the log message to the thread pool
SPDLOG_INLINE
void
spdlog
::
async_logger
::
sink_it_
(
details
::
log_msg
&
msg
)
...
...
include/spdlog/async_logger.h
View file @
6bcb422c
...
...
@@ -60,6 +60,6 @@ private:
};
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#include "async_logger-inl.h"
#endif
include/spdlog/common-inl.h
View file @
6bcb422c
// Copyright(c) 2015-present Gabi Melman & spdlog contributors.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma
once
#pragma once
namespace
spdlog
{
namespace
level
{
static
string_view_t
level_string_views
[]
SPDLOG_LEVEL_NAMES
;
SPDLOG_INLINE
spdlog
::
spdlog_ex
::
spdlog_ex
(
std
::
string
msg
)
:
msg_
(
std
::
move
(
msg
))
static
const
char
*
short_level_names
[]
SPDLOG_SHORT_LEVEL_NAMES
;
SPDLOG_INLINE
string_view_t
&
to_string_view
(
spdlog
::
level
::
level_enum
l
)
SPDLOG_NOEXCEPT
{
return
level_string_views
[
l
];
}
SPDLOG_INLINE
const
char
*
to_short_c_str
(
spdlog
::
level
::
level_enum
l
)
SPDLOG_NOEXCEPT
{
return
short_level_names
[
l
];
}
SPDLOG_INLINE
spdlog
::
spdlog_ex
::
spdlog_ex
(
const
std
::
string
&
msg
,
int
last_errno
)
SPDLOG_INLINE
spdlog
::
level
::
level_enum
from_str
(
const
std
::
string
&
name
)
SPDLOG_NOEXCEPT
{
int
level
=
0
;
for
(
const
auto
&
level_str
:
level_string_views
)
{
if
(
level_str
==
name
)
{
return
static_cast
<
level
::
level_enum
>
(
level
);
}
level
++
;
}
return
level
::
off
;
}
}
// namespace level
SPDLOG_INLINE
spdlog_ex
::
spdlog_ex
(
std
::
string
msg
)
:
msg_
(
std
::
move
(
msg
))
{}
SPDLOG_INLINE
spdlog_ex
::
spdlog_ex
(
const
std
::
string
&
msg
,
int
last_errno
)
{
fmt
::
memory_buffer
outbuf
;
fmt
::
format_system_error
(
outbuf
,
last_errno
,
msg
);
msg_
=
fmt
::
to_string
(
outbuf
);
}
SPDLOG_INLINE
const
char
*
spdlog
::
spdlog
_ex
::
what
()
const
SPDLOG_NOEXCEPT
SPDLOG_INLINE
const
char
*
spdlog_ex
::
what
()
const
SPDLOG_NOEXCEPT
{
return
msg_
.
c_str
();
}
}
// namespace spdlog
include/spdlog/common.h
View file @
6bcb422c
...
...
@@ -22,8 +22,10 @@
#include "spdlog/fmt/fmt.h"
#ifdef SPDLOG_STATIC_LIB
#undef SPDLOG_HEADER_ONLY
#define SPDLOG_INLINE
#else
#define SPDLOG_HEADER_ONLY
#define SPDLOG_INLINE inline
#endif
...
...
@@ -138,39 +140,18 @@ enum level_enum
"trace", "debug", "info", "warning", "error", "critical", "off" \
}
#endif
static
string_view_t
level_string_views
[]
SPDLOG_LEVEL_NAMES
;
#if !defined(SPDLOG_SHORT_LEVEL_NAMES)
#define SPDLOG_SHORT_LEVEL_NAMES \
{ \
"T", "D", "I", "W", "E", "C", "O" \
}
#endif
static
const
char
*
short_level_names
[]
SPDLOG_SHORT_LEVEL_NAMES
;
inline
string_view_t
&
to_string_view
(
spdlog
::
level
::
level_enum
l
)
SPDLOG_NOEXCEPT
{
return
level_string_views
[
l
];
}
inline
const
char
*
to_short_c_str
(
spdlog
::
level
::
level_enum
l
)
SPDLOG_NOEXCEPT
{
return
short_level_names
[
l
];
}
inline
spdlog
::
level
::
level_enum
from_str
(
const
std
::
string
&
name
)
SPDLOG_NOEXCEPT
{
int
level
=
0
;
for
(
const
auto
&
level_str
:
level_string_views
)
{
if
(
level_str
==
name
)
{
return
static_cast
<
level
::
level_enum
>
(
level
);
}
level
++
;
}
return
level
::
off
;
}
string_view_t
&
to_string_view
(
spdlog
::
level
::
level_enum
l
)
SPDLOG_NOEXCEPT
;
const
char
*
to_short_c_str
(
spdlog
::
level
::
level_enum
l
)
SPDLOG_NOEXCEPT
;
spdlog
::
level
::
level_enum
from_str
(
const
std
::
string
&
name
)
SPDLOG_NOEXCEPT
;
using
level_hasher
=
std
::
hash
<
int
>
;
}
// namespace level
...
...
@@ -206,8 +187,7 @@ struct source_loc
:
filename
{
filename_in
}
,
line
{
line_in
}
,
funcname
{
funcname_in
}
{
}
{}
SPDLOG_CONSTEXPR
bool
empty
()
const
SPDLOG_NOEXCEPT
{
...
...
@@ -234,6 +214,6 @@ std::unique_ptr<T> make_unique(Args &&... args)
}
// namespace details
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#include "common
t
-inl.h"
#if
def SPDLOG_HEADER_ONLY
#include "common-inl.h"
#endif
\ No newline at end of file
include/spdlog/details/circular_q.h
View file @
6bcb422c
...
...
@@ -17,8 +17,7 @@ public:
explicit
circular_q
(
size_t
max_items
)
:
max_items_
(
max_items
+
1
)
// one item is reserved as marker for full q
,
v_
(
max_items_
)
{
}
{}
// push back, overrun (oldest) item if no room left
void
push_back
(
T
&&
item
)
...
...
include/spdlog/details/console_globals.h
View file @
6bcb422c
...
...
@@ -3,7 +3,6 @@
#pragma once
#include "spdlog/details/null_mutex.h"
#include <cstdio>
#include <mutex>
...
...
include/spdlog/details/file_helper-inl.h
View file @
6bcb422c
...
...
@@ -14,6 +14,7 @@
namespace
spdlog
{
namespace
details
{
SPDLOG_INLINE
file_helper
::~
file_helper
()
{
close
();
...
...
include/spdlog/details/file_helper.h
View file @
6bcb422c
...
...
@@ -55,6 +55,6 @@ private:
}
// namespace details
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#include "file_helper-inl.h"
#endif
include/spdlog/details/log_msg-inl.h
View file @
6bcb422c
...
...
@@ -6,7 +6,10 @@
#include "spdlog/details/os.h"
#include "spdlog/sinks/sink.h"
SPDLOG_INLINE
spdlog
::
details
::
log_msg
::
log_msg
(
namespace
spdlog
{
namespace
details
{
SPDLOG_INLINE
log_msg
::
log_msg
(
spdlog
::
source_loc
loc
,
const
std
::
string
*
loggers_name
,
spdlog
::
level
::
level_enum
lvl
,
spdlog
::
string_view_t
view
)
:
logger_name
(
loggers_name
)
,
level
(
lvl
)
...
...
@@ -19,10 +22,11 @@ SPDLOG_INLINE spdlog::details::log_msg::log_msg(
#endif
,
source
(
loc
)
,
payload
(
view
)
{
}
{}
SPDLOG_INLINE
spdlog
::
details
::
log_msg
::
log_msg
(
const
std
::
string
*
loggers_name
,
spdlog
::
level
::
level_enum
lvl
,
spdlog
::
string_view_t
view
)
SPDLOG_INLINE
log_msg
::
log_msg
(
const
std
::
string
*
loggers_name
,
spdlog
::
level
::
level_enum
lvl
,
spdlog
::
string_view_t
view
)
:
log_msg
(
source_loc
{},
loggers_name
,
lvl
,
view
)
{
}
\ No newline at end of file
{}
}
// namespace details
}
// namespace spdlog
include/spdlog/details/log_msg.h
View file @
6bcb422c
...
...
@@ -11,7 +11,6 @@ namespace details {
struct
log_msg
{
log_msg
(
source_loc
loc
,
const
std
::
string
*
loggers_name
,
level
::
level_enum
lvl
,
string_view_t
view
);
log_msg
(
const
std
::
string
*
loggers_name
,
level
::
level_enum
lvl
,
string_view_t
view
);
log_msg
(
const
log_msg
&
other
)
=
default
;
...
...
@@ -31,6 +30,6 @@ struct log_msg
}
// namespace details
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#include "log_msg-inl.h"
#endif
include/spdlog/details/mpmc_blocking_q.h
View file @
6bcb422c
...
...
@@ -25,8 +25,7 @@ public:
using
item_type
=
T
;
explicit
mpmc_blocking_queue
(
size_t
max_items
)
:
q_
(
max_items
)
{
}
{}
#ifndef __MINGW32__
// try to enqueue and block if no room left
...
...
include/spdlog/details/null_mutex.h
View file @
6bcb422c
...
...
@@ -25,8 +25,7 @@ struct null_atomic_int
explicit
null_atomic_int
(
int
val
)
:
value
(
val
)
{
}
{}
int
load
(
std
::
memory_order
)
const
{
...
...
include/spdlog/details/os.h
View file @
6bcb422c
...
...
@@ -88,6 +88,6 @@ void wbuf_to_utf8buf(const fmt::wmemory_buffer &wbuf, fmt::memory_buffer &target
}
// namespace details
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#include "os-inl.h"
#endif
include/spdlog/details/pattern_formatter-inl.h
View file @
6bcb422c
...
...
@@ -58,8 +58,7 @@ public:
scoped_pad
(
spdlog
::
string_view_t
txt
,
padding_info
&
padinfo
,
fmt
::
memory_buffer
&
dest
)
:
scoped_pad
(
txt
.
size
(),
padinfo
,
dest
)
{
}
{}
~
scoped_pad
()
{
...
...
@@ -90,8 +89,7 @@ class name_formatter : public flag_formatter
public
:
explicit
name_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -113,8 +111,7 @@ class level_formatter : public flag_formatter
public
:
explicit
level_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -137,8 +134,7 @@ class short_level_formatter : public flag_formatter
public
:
explicit
short_level_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -169,8 +165,7 @@ class a_formatter : public flag_formatter
public
:
explicit
a_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -187,8 +182,7 @@ class A_formatter : public flag_formatter
public
:
explicit
A_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -205,8 +199,7 @@ class b_formatter : public flag_formatter
public
:
explicit
b_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -224,8 +217,7 @@ class B_formatter : public flag_formatter
public
:
explicit
B_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -241,8 +233,7 @@ class c_formatter final : public flag_formatter
public
:
explicit
c_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -273,8 +264,7 @@ class C_formatter final : public flag_formatter
public
:
explicit
C_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -290,8 +280,7 @@ class D_formatter final : public flag_formatter
public
:
explicit
D_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -327,8 +316,7 @@ class m_formatter final : public flag_formatter
public
:
explicit
m_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -344,8 +332,7 @@ class d_formatter final : public flag_formatter
public
:
explicit
d_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -361,8 +348,7 @@ class H_formatter final : public flag_formatter
public
:
explicit
H_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -707,8 +693,7 @@ class ch_formatter final : public flag_formatter
public
:
explicit
ch_formatter
(
char
ch
)
:
ch_
(
ch
)
{
}
{}
void
format
(
const
details
::
log_msg
&
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -746,8 +731,7 @@ class color_start_formatter final : public flag_formatter
public
:
explicit
color_start_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -759,8 +743,7 @@ class color_stop_formatter final : public flag_formatter
public
:
explicit
color_stop_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
@@ -864,8 +847,7 @@ class full_formatter final : public flag_formatter
public
:
explicit
full_formatter
(
padding_info
padinfo
)
:
flag_formatter
(
padinfo
)
{
}
{}
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
override
{
...
...
include/spdlog/details/pattern_formatter.h
View file @
6bcb422c
...
...
@@ -6,7 +6,6 @@
#include "spdlog/common.h"
#include "spdlog/details/log_msg.h"
#include "spdlog/details/os.h"
#include "spdlog/fmt/fmt.h"
#include "spdlog/formatter.h"
#include <chrono>
...
...
@@ -33,8 +32,7 @@ struct padding_info
padding_info
(
size_t
width
,
padding_info
::
pad_side
side
)
:
width_
(
width
)
,
side_
(
side
)
{
}
{}
bool
enabled
()
const
{
...
...
@@ -49,8 +47,7 @@ class flag_formatter
public
:
explicit
flag_formatter
(
padding_info
padinfo
)
:
padinfo_
(
padinfo
)
{
}
{}
flag_formatter
()
=
default
;
virtual
~
flag_formatter
()
=
default
;
virtual
void
format
(
const
details
::
log_msg
&
msg
,
const
std
::
tm
&
tm_time
,
fmt
::
memory_buffer
&
dest
)
=
0
;
...
...
@@ -83,8 +80,8 @@ private:
std
::
tm
cached_tm_
;
std
::
chrono
::
seconds
last_log_secs_
;
std
::
vector
<
std
::
unique_ptr
<
details
::
flag_formatter
>>
formatters_
;
std
::
tm
get_time_
(
const
details
::
log_msg
&
msg
);
std
::
tm
get_time_
(
const
details
::
log_msg
&
msg
);
void
handle_flag_
(
char
flag
,
details
::
padding_info
padding
);
// Extract given pad spec (e.g. %8X)
...
...
@@ -96,6 +93,6 @@ private:
};
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#include "pattern_formatter-inl.h"
#endif
include/spdlog/details/periodic_worker-inl.h
View file @
6bcb422c
...
...
@@ -2,8 +2,9 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#pragma once
SPDLOG_INLINE
spdlog
::
details
::
periodic_worker
::
periodic_worker
(
const
std
::
function
<
void
()
>
&
callback_fun
,
std
::
chrono
::
seconds
interval
)
namespace
spdlog
{
namespace
details
{
SPDLOG_INLINE
periodic_worker
::
periodic_worker
(
const
std
::
function
<
void
()
>
&
callback_fun
,
std
::
chrono
::
seconds
interval
)
{
active_
=
(
interval
>
std
::
chrono
::
seconds
::
zero
());
if
(
!
active_
)
...
...
@@ -25,7 +26,7 @@ SPDLOG_INLINE spdlog::details::periodic_worker::periodic_worker(const std::funct
}
// stop the worker thread and join it
SPDLOG_INLINE
spdlog
::
details
::
periodic_worker
::~
periodic_worker
()
SPDLOG_INLINE
periodic_worker
::~
periodic_worker
()
{
if
(
worker_thread_
.
joinable
())
{
...
...
@@ -37,3 +38,6 @@ SPDLOG_INLINE spdlog::details::periodic_worker::~periodic_worker()
worker_thread_
.
join
();
}
}
}
// namespace details
}
// namespace spdlog
include/spdlog/details/periodic_worker.h
View file @
6bcb422c
...
...
@@ -35,6 +35,6 @@ private:
}
// namespace details
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#include "periodic_worker-inl.h"
#endif
include/spdlog/details/registry.h
View file @
6bcb422c
...
...
@@ -99,6 +99,6 @@ private:
}
// namespace details
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#include "registry-inl.h"
#endif
include/spdlog/details/thread_pool-inl.h
View file @
6bcb422c
...
...
@@ -5,7 +5,9 @@
#include "spdlog/common.h"
SPDLOG_INLINE
spdlog
::
details
::
thread_pool
::
thread_pool
(
size_t
q_max_items
,
size_t
threads_n
)
namespace
spdlog
{
namespace
details
{
SPDLOG_INLINE
thread_pool
::
thread_pool
(
size_t
q_max_items
,
size_t
threads_n
)
:
q_
(
q_max_items
)
{
if
(
threads_n
==
0
||
threads_n
>
1000
)
...
...
@@ -20,7 +22,7 @@ SPDLOG_INLINE spdlog::details::thread_pool::thread_pool(size_t q_max_items, size
}
// message all threads to terminate gracefully join them
SPDLOG_INLINE
spdlog
::
details
::
thread_pool
::~
thread_pool
()
SPDLOG_INLINE
thread_pool
::~
thread_pool
()
{
try
{
...
...
@@ -35,28 +37,26 @@ SPDLOG_INLINE spdlog::details::thread_pool::~thread_pool()
}
}
catch
(...)
{
}
{}
}
void
SPDLOG_INLINE
spdlog
::
details
::
thread_pool
::
post_log
(
async_logger_ptr
&&
worker_ptr
,
details
::
log_msg
&
msg
,
async_overflow_policy
overflow_policy
)
void
SPDLOG_INLINE
thread_pool
::
post_log
(
async_logger_ptr
&&
worker_ptr
,
details
::
log_msg
&
msg
,
async_overflow_policy
overflow_policy
)
{
async_msg
async_m
(
std
::
move
(
worker_ptr
),
async_msg_type
::
log
,
msg
);
post_async_msg_
(
std
::
move
(
async_m
),
overflow_policy
);
}
void
SPDLOG_INLINE
spdlog
::
details
::
thread_pool
::
post_flush
(
async_logger_ptr
&&
worker_ptr
,
async_overflow_policy
overflow_policy
)
void
SPDLOG_INLINE
thread_pool
::
post_flush
(
async_logger_ptr
&&
worker_ptr
,
async_overflow_policy
overflow_policy
)
{
post_async_msg_
(
async_msg
(
std
::
move
(
worker_ptr
),
async_msg_type
::
flush
),
overflow_policy
);
}
size_t
SPDLOG_INLINE
spdlog
::
details
::
thread_pool
::
overrun_counter
()
size_t
SPDLOG_INLINE
thread_pool
::
overrun_counter
()
{
return
q_
.
overrun_counter
();
}
void
SPDLOG_INLINE
spdlog
::
details
::
thread_pool
::
post_async_msg_
(
async_msg
&&
new_msg
,
async_overflow_policy
overflow_policy
)
void
SPDLOG_INLINE
thread_pool
::
post_async_msg_
(
async_msg
&&
new_msg
,
async_overflow_policy
overflow_policy
)
{
if
(
overflow_policy
==
async_overflow_policy
::
block
)
{
...
...
@@ -68,7 +68,7 @@ void SPDLOG_INLINE spdlog::details::thread_pool::post_async_msg_(async_msg &&new
}
}
void
SPDLOG_INLINE
spdlog
::
details
::
thread_pool
::
worker_loop_
()
void
SPDLOG_INLINE
thread_pool
::
worker_loop_
()
{
while
(
process_next_msg_
())
{};
}
...
...
@@ -76,7 +76,7 @@ void SPDLOG_INLINE spdlog::details::thread_pool::worker_loop_()
// process next message in the queue
// return true if this thread should still be active (while no terminate msg
// was received)
bool
SPDLOG_INLINE
spdlog
::
details
::
thread_pool
::
process_next_msg_
()
bool
SPDLOG_INLINE
thread_pool
::
process_next_msg_
()
{
async_msg
incoming_async_msg
;
bool
dequeued
=
q_
.
dequeue_for
(
incoming_async_msg
,
std
::
chrono
::
seconds
(
10
));
...
...
@@ -107,3 +107,6 @@ bool SPDLOG_INLINE spdlog::details::thread_pool::process_next_msg_()
assert
(
false
&&
"Unexpected async_msg_type"
);
return
true
;
}
}
// namespace details
}
// namespace spdlog
include/spdlog/details/thread_pool.h
View file @
6bcb422c
...
...
@@ -57,8 +57,7 @@ struct async_msg
msg_id
(
other
.
msg_id
),
source
(
other
.
source
),
worker_ptr
(
std
::
move
(
other
.
worker_ptr
))
{
}
{}
async_msg
&
operator
=
(
async_msg
&&
other
)
SPDLOG_NOEXCEPT
{
...
...
@@ -98,13 +97,11 @@ struct async_msg
,
msg_id
(
0
)
,
source
()
,
worker_ptr
(
std
::
move
(
worker
))
{
}
{}
explicit
async_msg
(
async_msg_type
the_type
)
:
async_msg
(
nullptr
,
the_type
)
{
}
{}
// copy into log_msg
log_msg
to_log_msg
()
...
...
@@ -154,6 +151,6 @@ private:
}
// namespace details
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#include "thread_pool-inl.h"
#endif
\ No newline at end of file
include/spdlog/fmt/bin_to_hex.h
View file @
6bcb422c
...
...
@@ -31,8 +31,7 @@ public:
bytes_range
(
It
range_begin
,
It
range_end
)
:
begin_
(
range_begin
)
,
end_
(
range_end
)
{
}
{}
It
begin
()
const
{
...
...
include/spdlog/fmt/fmt.h
View file @
6bcb422c
...
...
@@ -11,7 +11,7 @@
//
#if !defined(SPDLOG_FMT_EXTERNAL)
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#ifndef FMT_HEADER_ONLY
#define FMT_HEADER_ONLY
#endif
...
...
include/spdlog/logger-inl.h
View file @
6bcb422c
...
...
@@ -6,8 +6,9 @@
#include "spdlog/sinks/sink.h"
#include "spdlog/details/pattern_formatter.h"
namespace
spdlog
{
// public methods
SPDLOG_INLINE
void
spdlog
::
logger
::
log
(
spdlog
::
source_loc
loc
,
spdlog
::
level
::
level_enum
lvl
,
const
char
*
msg
)
SPDLOG_INLINE
void
logger
::
log
(
source_loc
loc
,
level
::
level_enum
lvl
,
const
char
*
msg
)
{
if
(
!
should_log
(
lvl
))
{
...
...
@@ -16,7 +17,7 @@ SPDLOG_INLINE void spdlog::logger::log(spdlog::source_loc loc, spdlog::level::le
try
{
details
::
log_msg
log_msg
(
loc
,
&
name_
,
lvl
,
s
pdlog
::
s
tring_view_t
(
msg
));
details
::
log_msg
log_msg
(
loc
,
&
name_
,
lvl
,
string_view_t
(
msg
));
sink_it_
(
log_msg
);
}
catch
(
const
std
::
exception
&
ex
)
...
...
@@ -29,39 +30,39 @@ SPDLOG_INLINE void spdlog::logger::log(spdlog::source_loc loc, spdlog::level::le
}
}
SPDLOG_INLINE
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
char
*
msg
)
SPDLOG_INLINE
void
logger
::
log
(
level
::
level_enum
lvl
,
const
char
*
msg
)
{
log
(
source_loc
{},
lvl
,
msg
);
}
SPDLOG_INLINE
bool
spdlog
::
logger
::
should_log
(
spdlog
::
level
::
level_enum
msg_level
)
const
SPDLOG_INLINE
bool
logger
::
should_log
(
level
::
level_enum
msg_level
)
const
{
return
msg_level
>=
level_
.
load
(
std
::
memory_order_relaxed
);
}
SPDLOG_INLINE
void
spdlog
::
logger
::
set_level
(
spdlog
::
level
::
level_enum
log_level
)
SPDLOG_INLINE
void
logger
::
set_level
(
level
::
level_enum
log_level
)
{
level_
.
store
(
log_level
);
}
SPDLOG_INLINE
spdlog
::
level
::
level_enum
spdlog
::
logger
::
default_level
()
SPDLOG_INLINE
level
::
level_enum
logger
::
default_level
()
{
return
static_cast
<
spdlog
::
level
::
level_enum
>
(
SPDLOG_ACTIVE_LEVEL
);
return
static_cast
<
level
::
level_enum
>
(
SPDLOG_ACTIVE_LEVEL
);
}
SPDLOG_INLINE
spdlog
::
level
::
level_enum
spdlog
::
logger
::
level
()
const
SPDLOG_INLINE
level
::
level_enum
logger
::
level
()
const
{
return
static_cast
<
spdlog
::
level
::
level_enum
>
(
level_
.
load
(
std
::
memory_order_relaxed
));
return
static_cast
<
level
::
level_enum
>
(
level_
.
load
(
std
::
memory_order_relaxed
));
}
SPDLOG_INLINE
const
std
::
string
&
spdlog
::
logger
::
name
()
const
SPDLOG_INLINE
const
std
::
string
&
logger
::
name
()
const
{
return
name_
;
}
// set formatting for the sinks in this logger.
// each sink will get a seperate instance of the formatter object.
SPDLOG_INLINE
void
spdlog
::
logger
::
set_formatter
(
std
::
unique_ptr
<
spdlog
::
formatter
>
f
)
SPDLOG_INLINE
void
logger
::
set_formatter
(
std
::
unique_ptr
<
formatter
>
f
)
{
for
(
auto
&
sink
:
sinks_
)
{
...
...
@@ -69,14 +70,14 @@ SPDLOG_INLINE void spdlog::logger::set_formatter(std::unique_ptr<spdlog::formatt
}
}
SPDLOG_INLINE
void
spdlog
::
logger
::
set_pattern
(
std
::
string
pattern
,
spdlog
::
pattern_time_type
time_type
)
SPDLOG_INLINE
void
logger
::
set_pattern
(
std
::
string
pattern
,
pattern_time_type
time_type
)
{
auto
new_formatter
=
details
::
make_unique
<
spdlog
::
pattern_formatter
>
(
std
::
move
(
pattern
),
time_type
);
auto
new_formatter
=
details
::
make_unique
<
pattern_formatter
>
(
std
::
move
(
pattern
),
time_type
);
set_formatter
(
std
::
move
(
new_formatter
));
}
// flush functions
SPDLOG_INLINE
void
spdlog
::
logger
::
flush
()
SPDLOG_INLINE
void
logger
::
flush
()
{
try
{
...
...
@@ -92,37 +93,37 @@ SPDLOG_INLINE void spdlog::logger::flush()
}
}
SPDLOG_INLINE
void
spdlog
::
logger
::
flush_on
(
level
::
level_enum
log_level
)
SPDLOG_INLINE
void
logger
::
flush_on
(
level
::
level_enum
log_level
)
{
flush_level_
.
store
(
log_level
);
}
SPDLOG_INLINE
spdlog
::
level
::
level_enum
spdlog
::
logger
::
flush_level
()
const
SPDLOG_INLINE
level
::
level_enum
logger
::
flush_level
()
const
{
return
static_cast
<
spdlog
::
level
::
level_enum
>
(
flush_level_
.
load
(
std
::
memory_order_relaxed
));
return
static_cast
<
level
::
level_enum
>
(
flush_level_
.
load
(
std
::
memory_order_relaxed
));
}
// sinks
SPDLOG_INLINE
const
std
::
vector
<
s
pdlog
::
sink_ptr
>
&
spdlog
::
logger
::
sinks
()
const
SPDLOG_INLINE
const
std
::
vector
<
s
ink_ptr
>
&
logger
::
sinks
()
const
{
return
sinks_
;
}
SPDLOG_INLINE
std
::
vector
<
s
pdlog
::
sink_ptr
>
&
spdlog
::
logger
::
sinks
()
SPDLOG_INLINE
std
::
vector
<
s
ink_ptr
>
&
logger
::
sinks
()
{
return
sinks_
;
}
// error handler
SPDLOG_INLINE
void
spdlog
::
logger
::
set_error_handler
(
err_handler
handler
)
SPDLOG_INLINE
void
logger
::
set_error_handler
(
err_handler
handler
)
{
custom_err_handler_
=
handler
;
}
// create new logger with same sinks and configuration.
SPDLOG_INLINE
std
::
shared_ptr
<
spdlog
::
logger
>
spdlog
::
logger
::
clone
(
std
::
string
logger_name
)
SPDLOG_INLINE
std
::
shared_ptr
<
logger
>
logger
::
clone
(
std
::
string
logger_name
)
{
auto
cloned
=
std
::
make_shared
<
spdlog
::
logger
>
(
std
::
move
(
logger_name
),
sinks_
.
begin
(),
sinks_
.
end
());
auto
cloned
=
std
::
make_shared
<
logger
>
(
std
::
move
(
logger_name
),
sinks_
.
begin
(),
sinks_
.
end
());
cloned
->
set_level
(
this
->
level
());
cloned
->
flush_on
(
this
->
flush_level
());
cloned
->
set_error_handler
(
this
->
custom_err_handler_
);
...
...
@@ -130,7 +131,7 @@ SPDLOG_INLINE std::shared_ptr<spdlog::logger> spdlog::logger::clone(std::string
}
// protected methods
SPDLOG_INLINE
void
spdlog
::
logger
::
sink_it_
(
spdlog
::
details
::
log_msg
&
msg
)
SPDLOG_INLINE
void
logger
::
sink_it_
(
details
::
log_msg
&
msg
)
{
for
(
auto
&
sink
:
sinks_
)
{
...
...
@@ -146,7 +147,7 @@ SPDLOG_INLINE void spdlog::logger::sink_it_(spdlog::details::log_msg &msg)
}
}
SPDLOG_INLINE
void
spdlog
::
logger
::
flush_
()
SPDLOG_INLINE
void
logger
::
flush_
()
{
for
(
auto
&
sink
:
sinks_
)
{
...
...
@@ -154,13 +155,13 @@ SPDLOG_INLINE void spdlog::logger::flush_()
}
}
SPDLOG_INLINE
bool
spdlog
::
logger
::
should_flush_
(
const
spdlog
::
details
::
log_msg
&
msg
)
SPDLOG_INLINE
bool
logger
::
should_flush_
(
const
details
::
log_msg
&
msg
)
{
auto
flush_level
=
flush_level_
.
load
(
std
::
memory_order_relaxed
);
return
(
msg
.
level
>=
flush_level
)
&&
(
msg
.
level
!=
level
::
off
);
}
SPDLOG_INLINE
void
spdlog
::
logger
::
err_handler_
(
const
std
::
string
&
msg
)
SPDLOG_INLINE
void
logger
::
err_handler_
(
const
std
::
string
&
msg
)
{
if
(
custom_err_handler_
)
{
...
...
@@ -168,9 +169,10 @@ SPDLOG_INLINE void spdlog::logger::err_handler_(const std::string &msg)
}
else
{
auto
tm_time
=
spdlog
::
details
::
os
::
localtime
();
auto
tm_time
=
details
::
os
::
localtime
();
char
date_buf
[
64
];
std
::
strftime
(
date_buf
,
sizeof
(
date_buf
),
"%Y-%m-%d %H:%M:%S"
,
&
tm_time
);
fmt
::
print
(
stderr
,
"[*** LOG ERROR ***] [{}] [{}] {}
\n
"
,
date_buf
,
name
(),
msg
);
}
}
}
// namespace spdlog
\ No newline at end of file
include/spdlog/logger.h
View file @
6bcb422c
...
...
@@ -35,17 +35,14 @@ public:
logger
(
std
::
string
name
,
It
begin
,
It
end
)
:
name_
(
std
::
move
(
name
))
,
sinks_
(
begin
,
end
)
{
}
{}
logger
(
std
::
string
name
,
sink_ptr
single_sink
)
:
logger
(
std
::
move
(
name
),
{
std
::
move
(
single_sink
)})
{
}
{}
logger
(
std
::
string
name
,
sinks_init_list
sinks
)
:
logger
(
std
::
move
(
name
),
sinks
.
begin
(),
sinks
.
end
())
{
}
{}
virtual
~
logger
()
=
default
;
...
...
@@ -338,6 +335,6 @@ protected:
};
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#include "logger-inl.h"
#endif
include/spdlog/sinks/android_sink.h
View file @
6bcb422c
...
...
@@ -35,8 +35,7 @@ public:
explicit
android_sink
(
std
::
string
tag
=
"spdlog"
,
bool
use_raw_msg
=
false
)
:
tag_
(
std
::
move
(
tag
))
,
use_raw_msg_
(
use_raw_msg
)
{
}
{}
protected
:
void
sink_it_
(
const
details
::
log_msg
&
msg
)
override
...
...
include/spdlog/sinks/ansicolor_sink.h
View file @
6bcb422c
...
...
@@ -89,6 +89,6 @@ using ansicolor_stderr_sink_st = ansicolor_sink<details::console_stderr, details
}
// namespace sinks
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#include "ansicolor_sink-inl.h"
#endif
\ No newline at end of file
include/spdlog/sinks/ostream_sink.h
View file @
6bcb422c
...
...
@@ -22,8 +22,7 @@ public:
explicit
ostream_sink
(
std
::
ostream
&
os
,
bool
force_flush
=
false
)
:
ostream_
(
os
)
,
force_flush_
(
force_flush
)
{
}
{}
ostream_sink
(
const
ostream_sink
&
)
=
delete
;
ostream_sink
&
operator
=
(
const
ostream_sink
&
)
=
delete
;
...
...
include/spdlog/sinks/sink-inl.h
View file @
6bcb422c
...
...
@@ -8,13 +8,11 @@
SPDLOG_INLINE
spdlog
::
sinks
::
sink
::
sink
()
:
formatter_
{
details
::
make_unique
<
spdlog
::
pattern_formatter
>
()}
{
}
{}
SPDLOG_INLINE
spdlog
::
sinks
::
sink
::
sink
(
std
::
unique_ptr
<
spdlog
::
formatter
>
formatter
)
:
formatter_
{
std
::
move
(
formatter
)}
{
}
{}
SPDLOG_INLINE
bool
spdlog
::
sinks
::
sink
::
should_log
(
spdlog
::
level
::
level_enum
msg_level
)
const
{
...
...
include/spdlog/sinks/sink.h
View file @
6bcb422c
...
...
@@ -38,6 +38,6 @@ protected:
}
// namespace sinks
}
// namespace spdlog
#if
ndef SPDLOG_STATIC_LIB
#if
def SPDLOG_HEADER_ONLY
#include "sink-inl.h"
#endif
include/spdlog/sinks/stdout_sinks.h
View file @
6bcb422c
...
...
@@ -26,8 +26,7 @@ public:
stdout_sink
()
:
mutex_
(
ConsoleMutex
::
mutex
())
,
file_
(
TargetStream
::
stream
())
{
}
{}
~
stdout_sink
()
override
=
default
;
stdout_sink
(
const
stdout_sink
&
other
)
=
delete
;
...
...
src/format.cc
deleted
100644 → 0
View file @
540f8653
// Copyright (c) 2012 - 2016, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.
// Slightly modified version of fmt lib to include bundled format-inl.h
#if !defined(SPDLOG_FMT_EXTERNAL)
#include "spdlog/fmt/bundled/format-inl.h"
#else
#include "fmt/format-inl.h"
#endif
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
>
);
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
);
// 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
src/format.cpp
0 → 100644
View file @
6bcb422c
// Copyright (c) 2012 - 2016, Victor Zverovich
// All rights reserved.
//
// For the license information refer to format.h.
// Slightly modified version of fmt lib to include bundled format-inl.h
#if !defined(SPDLOG_FMT_EXTERNAL)
#include "spdlog/fmt/bundled/format-inl.h"
#else
#include "fmt/format-inl.h"
#endif
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
>
);
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
);
// 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
src/spdlog.cpp
View file @
6bcb422c
...
...
@@ -2,11 +2,11 @@
// Distributed under the MIT License (http://opensource.org/licenses/MIT)
#include <mutex>
#include <chrono>
#include "spdlog/common.h"
#include "spdlog/common-inl.h"
#include "spdlog/details/null_mutex.h"
#include "spdlog/logger.h"
...
...
@@ -51,3 +51,8 @@ template class spdlog::sinks::ansicolor_sink<spdlog::details::console_stdout, sp
template
class
spdlog
::
sinks
::
ansicolor_sink
<
spdlog
::
details
::
console_stdout
,
spdlog
::
details
::
console_nullmutex
>
;
template
class
spdlog
::
sinks
::
ansicolor_sink
<
spdlog
::
details
::
console_stderr
,
spdlog
::
details
::
console_mutex
>
;
template
class
spdlog
::
sinks
::
ansicolor_sink
<
spdlog
::
details
::
console_stderr
,
spdlog
::
details
::
console_nullmutex
>
;
// fmt_helper templates
#include "spdlog/details/fmt_helper.h"
template
void
spdlog
::
details
::
fmt_helper
::
append_string_view
(
spdlog
::
string_view_t
view
,
fmt
::
memory_buffer
&
dest
);
template
spdlog
::
string_view_t
spdlog
::
details
::
fmt_helper
::
to_string_view
(
const
fmt
::
memory_buffer
&
buf
)
SPDLOG_NOEXCEPT
;
tests/test_errors.cpp
View file @
6bcb422c
...
...
@@ -39,8 +39,7 @@ TEST_CASE("default_error_handler", "[errors]]")
}
struct
custom_ex
{
};
{};
TEST_CASE
(
"custom_error_handler"
,
"[errors]]"
)
{
prepare_logdir
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment