mirror of
https://github.com/gabime/spdlog.git
synced 2025-01-12 08:50:26 +08:00
fix common.h
This commit is contained in:
commit
96b7214ae2
@ -79,6 +79,8 @@ async... Elapsed: 0.349851 2,858,358/sec
|
|||||||
#### Basic usage
|
#### Basic usage
|
||||||
```c++
|
```c++
|
||||||
#include "spdlog/spdlog.h"
|
#include "spdlog/spdlog.h"
|
||||||
|
#include "spdlog/sinks/basic_file_sink.h"
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
spdlog::info("Welcome to spdlog!");
|
spdlog::info("Welcome to spdlog!");
|
||||||
|
@ -72,7 +72,7 @@
|
|||||||
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
|
#if defined(_WIN32) && defined(SPDLOG_WCHAR_FILENAMES)
|
||||||
using filename_t = std::wstring;
|
using filename_t = std::wstring;
|
||||||
#define SPDLOG_FILENAME_T(s) L##s
|
#define SPDLOG_FILENAME_T(s) L##s
|
||||||
SPDLOG_INLINE std::string filename_to_str(const filename_t &filename)
|
inline std::string filename_to_str(const filename_t &filename)
|
||||||
{
|
{
|
||||||
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> c;
|
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> c;
|
||||||
return c.to_bytes(filename);
|
return c.to_bytes(filename);
|
||||||
|
@ -328,7 +328,10 @@ inline void critical(const wchar_t *fmt, const Args &... args)
|
|||||||
//
|
//
|
||||||
|
|
||||||
#define SPDLOG_LOGGER_CALL(logger, level, ...) \
|
#define SPDLOG_LOGGER_CALL(logger, level, ...) \
|
||||||
logger->log(spdlog::source_loc{SPDLOG_FILE_BASENAME(__FILE__), __LINE__, SPDLOG_FUNCTION}, level, __VA_ARGS__)
|
do { \
|
||||||
|
if (logger->should_log(level)) \
|
||||||
|
logger->log(spdlog::source_loc{SPDLOG_FILE_BASENAME(__FILE__), __LINE__, SPDLOG_FUNCTION}, level, __VA_ARGS__); \
|
||||||
|
} while (0)
|
||||||
|
|
||||||
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE
|
#if SPDLOG_ACTIVE_LEVEL <= SPDLOG_LEVEL_TRACE
|
||||||
#define SPDLOG_LOGGER_TRACE(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::trace, __VA_ARGS__)
|
#define SPDLOG_LOGGER_TRACE(logger, ...) SPDLOG_LOGGER_CALL(logger, spdlog::level::trace, __VA_ARGS__)
|
||||||
|
Loading…
Reference in New Issue
Block a user