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
eb92cc35
Commit
eb92cc35
authored
May 16, 2017
by
gabime
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/gabime/spdlog.git
parents
bd25f59a
a39f71db
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
97 additions
and
12 deletions
+97
-12
async_log_helper.h
include/spdlog/details/async_log_helper.h
+10
-10
logger_impl.h
include/spdlog/details/logger_impl.h
+57
-0
os.h
include/spdlog/details/os.h
+13
-1
logger.h
include/spdlog/logger.h
+10
-0
tweakme.h
include/spdlog/tweakme.h
+6
-0
CMakeLists.txt
tests/CMakeLists.txt
+1
-1
No files found.
include/spdlog/details/async_log_helper.h
View file @
eb92cc35
...
...
@@ -56,19 +56,19 @@ class async_log_helper
~
async_msg
()
=
default
;
async_msg
(
async_msg
&&
other
)
SPDLOG_NOEXCEPT
:
logger_name
(
std
::
move
(
other
.
logger_name
)),
level
(
std
::
move
(
other
.
level
)),
time
(
std
::
move
(
other
.
time
)),
thread_id
(
other
.
thread_id
),
txt
(
std
::
move
(
other
.
txt
)),
msg_type
(
std
::
move
(
other
.
msg_type
))
async_msg
(
async_msg
&&
other
)
SPDLOG_NOEXCEPT
:
logger_name
(
std
::
move
(
other
.
logger_name
)),
level
(
std
::
move
(
other
.
level
)),
time
(
std
::
move
(
other
.
time
)),
thread_id
(
other
.
thread_id
),
txt
(
std
::
move
(
other
.
txt
)),
msg_type
(
std
::
move
(
other
.
msg_type
))
{}
async_msg
(
async_msg_type
m_type
)
:
level
(
level
::
info
),
thread_id
(
0
),
msg_type
(
m_type
)
level
(
level
::
info
),
thread_id
(
0
),
msg_type
(
m_type
)
{}
async_msg
&
operator
=
(
async_msg
&&
other
)
SPDLOG_NOEXCEPT
...
...
include/spdlog/details/logger_impl.h
View file @
eb92cc35
...
...
@@ -195,6 +195,63 @@ inline void spdlog::logger::critical(const T& msg)
log
(
level
::
critical
,
msg
);
}
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
#include <codecvt>
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
msg
)
{
std
::
wstring_convert
<
std
::
codecvt_utf8
<
wchar_t
>
>
conv
;
log
(
lvl
,
conv
.
to_bytes
(
msg
));
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
fmt
::
WMemoryWriter
wWriter
;
wWriter
.
write
(
fmt
,
args
...);
log
(
lvl
,
wWriter
.
c_str
());
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
trace
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
trace
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
debug
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
debug
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
info
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
info
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
warn
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
warn
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
error
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
err
,
fmt
,
args
...);
}
template
<
typename
...
Args
>
inline
void
spdlog
::
logger
::
critical
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
)
{
log
(
level
::
critical
,
fmt
,
args
...);
}
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
...
...
include/spdlog/details/os.h
View file @
eb92cc35
...
...
@@ -365,6 +365,17 @@ inline std::string filename_to_str(const filename_t& filename)
}
#endif
inline
std
::
string
errno_to_string
(
char
[
256
],
char
*
res
)
{
return
std
::
string
(
res
);
}
inline
std
::
string
errno_to_string
(
char
buf
[
256
],
int
res
)
{
if
(
res
==
0
)
{
return
std
::
string
(
buf
);
}
else
{
return
"Unknown error"
;
}
}
// Return errno string (thread safe)
inline
std
::
string
errno_str
(
int
err_num
)
...
...
@@ -387,7 +398,8 @@ inline std::string errno_str(int err_num)
return
"Unknown error"
;
#else // gnu version (might not use the given buf, so its retval pointer must be used)
return
std
::
string
(
strerror_r
(
err_num
,
buf
,
buf_size
));
auto
err
=
strerror_r
(
err_num
,
buf
,
buf_size
);
// let compiler choose type
return
errno_to_string
(
buf
,
err
);
// use overloading to select correct stringify function
#endif
}
...
...
include/spdlog/logger.h
View file @
eb92cc35
...
...
@@ -43,6 +43,16 @@ public:
template
<
typename
Arg1
,
typename
...
Args
>
void
warn
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
error
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
template
<
typename
Arg1
,
typename
...
Args
>
void
critical
(
const
char
*
fmt
,
const
Arg1
&
,
const
Args
&
...
args
);
#ifdef SPDLOG_WCHAR_TO_UTF8_SUPPORT
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
msg
);
template
<
typename
...
Args
>
void
log
(
level
::
level_enum
lvl
,
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
trace
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
debug
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
info
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
warn
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
error
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
template
<
typename
...
Args
>
void
critical
(
const
wchar_t
*
fmt
,
const
Args
&
...
args
);
#endif // SPDLOG_WCHAR_TO_UTF8_SUPPORT
template
<
typename
T
>
void
log
(
level
::
level_enum
lvl
,
const
T
&
);
template
<
typename
T
>
void
trace
(
const
T
&
);
...
...
include/spdlog/tweakme.h
View file @
eb92cc35
...
...
@@ -101,6 +101,12 @@
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to enable wchar_t support (convert to utf8)
//
// #define SPDLOG_WCHAR_TO_UTF8_SUPPORT
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
// Uncomment to prevent child processes from inheriting log file descriptors
//
...
...
tests/CMakeLists.txt
View file @
eb92cc35
...
...
@@ -10,7 +10,7 @@ find_package(Threads)
add_library
(
catch INTERFACE
)
target_include_directories
(
catch INTERFACE
${
CMAKE_CURRENT_SOURCE_DIR
}
)
file
(
GLOB catch_tests LIST_DIRECTORIES false RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
)
file
(
GLOB catch_tests LIST_DIRECTORIES false RELATIVE
${
CMAKE_CURRENT_SOURCE_DIR
}
*.cpp
*.h *.hpp
)
add_executable
(
catch_tests
${
catch_tests
}
)
target_link_libraries
(
catch_tests spdlog
${
CMAKE_THREAD_LIBS_INIT
}
)
...
...
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