mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
Merge branch 'v1.x' into std-format
This commit is contained in:
commit
8e359baaec
@ -14,6 +14,7 @@
|
|||||||
#include <spdlog/details/os.h>
|
#include <spdlog/details/os.h>
|
||||||
|
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
//
|
//
|
||||||
// Support for logging binary data as hex
|
// Support for logging binary data as hex
|
||||||
// format flags, any combination of the followng:
|
// format flags, any combination of the following:
|
||||||
// {:X} - print in uppercase.
|
// {:X} - print in uppercase.
|
||||||
// {:s} - don't separate each byte with space.
|
// {:s} - don't separate each byte with space.
|
||||||
// {:p} - don't print the position on each line start.
|
// {:p} - don't print the position on each line start.
|
||||||
|
@ -52,7 +52,7 @@ struct daily_filename_format_calculator
|
|||||||
filename_t fmt_filename = fmt_lib::format(SPDLOG_FILENAME_T("{{:{}}}"), filename);
|
filename_t fmt_filename = fmt_lib::format(SPDLOG_FILENAME_T("{{:{}}}"), filename);
|
||||||
#if defined(SPDLOG_USE_STD_FORMAT)
|
#if defined(SPDLOG_USE_STD_FORMAT)
|
||||||
return std::vformat(fmt_filename, std::make_format_args(now_tm));
|
return std::vformat(fmt_filename, std::make_format_args(now_tm));
|
||||||
#elif defined(_MSC_VER) && defined(SPDLOG_WCHAR_FILENAMES) // for some reason msvc doesnt allow fmt::runtime(..) with wchar here
|
#elif defined(_MSC_VER) && defined(SPDLOG_WCHAR_FILENAMES) // for some reason msvc doesn't allow fmt::runtime(..) with wchar here
|
||||||
return fmt::format(fmt_filename, now_tm);
|
return fmt::format(fmt_filename, now_tm);
|
||||||
#else
|
#else
|
||||||
return fmt::format(SPDLOG_FMT_RUNTIME(fmt_filename), now_tm);
|
return fmt::format(SPDLOG_FMT_RUNTIME(fmt_filename), now_tm);
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
// so instead we use ::FileWrite
|
// so instead we use ::FileWrite
|
||||||
# include <spdlog/details/windows_include.h>
|
# include <spdlog/details/windows_include.h>
|
||||||
|
|
||||||
# ifndef _USING_V110_SDK71_ // fileapi.h doesnt exist in winxp
|
# ifndef _USING_V110_SDK71_ // fileapi.h doesn't exist in winxp
|
||||||
# include <fileapi.h> // WriteFile (..)
|
# include <fileapi.h> // WriteFile (..)
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
@ -60,7 +60,7 @@ SPDLOG_INLINE void stdout_sink_base<ConsoleMutex>::log(const details::log_msg &m
|
|||||||
std::lock_guard<mutex_t> lock(mutex_);
|
std::lock_guard<mutex_t> lock(mutex_);
|
||||||
memory_buf_t formatted;
|
memory_buf_t formatted;
|
||||||
formatter_->format(msg, formatted);
|
formatter_->format(msg, formatted);
|
||||||
::fflush(file_); // flush in case there is somthing in this file_ already
|
::fflush(file_); // flush in case there is something in this file_ already
|
||||||
auto size = static_cast<DWORD>(formatted.size());
|
auto size = static_cast<DWORD>(formatted.size());
|
||||||
DWORD bytes_written = 0;
|
DWORD bytes_written = 0;
|
||||||
bool ok = ::WriteFile(handle_, formatted.data(), size, &bytes_written, nullptr) != 0;
|
bool ok = ::WriteFile(handle_, formatted.data(), size, &bytes_written, nullptr) != 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user