1
0
mirror of https://github.com/gabime/spdlog.git synced 2025-01-15 17:27:57 +00:00

Compare commits

...

9 Commits

Author SHA1 Message Date
Gabi Melman
ea5e7182ab
Merge pull request #1444 from Crunkle/v1.x
Fix Windows event log sink
2020-02-17 21:37:27 +02:00
Crunkle
d38d53d9dd Fix Win32 event log sink 2020-02-17 17:15:43 +00:00
Gabi Melman
c9e094d9fc
Merge pull request #1442 from niamster/v1.x
workaround for `Unknown extension ".c" for file` issue
2020-02-16 22:41:52 +02:00
Dmytro Milinevskyi
af75985ec6 workaround for Unknown extension ".c" for file issue
http://www.grokit.ca/cnt/CMakeProblemsSolutions/
2020-02-16 19:57:49 +01:00
gabime
4b7c05903b optimize wincolor_sink to use array instead of map to find color codes 2020-02-15 12:11:01 +02:00
gabime
695912c7cf Optimize ansicolor_sink to use array instead of map to find color codes 2020-02-15 12:06:01 +02:00
gabime
5c06306ccc Updated clang-tidy 2020-02-15 12:05:07 +02:00
gabime
d4fd17f64f Fixed #1439 2020-02-15 11:29:04 +02:00
Gabi Melman
76d94e69ae
Fix #1439 2020-02-15 10:57:12 +02:00
7 changed files with 10 additions and 7 deletions

View File

@ -3,6 +3,8 @@
cmake_minimum_required(VERSION 3.2)
ENABLE_LANGUAGE(C)
#---------------------------------------------------------------------------------------
# Start spdlog project
#---------------------------------------------------------------------------------------

View File

@ -147,6 +147,7 @@ enum level_enum
err = SPDLOG_LEVEL_ERROR,
critical = SPDLOG_LEVEL_CRITICAL,
off = SPDLOG_LEVEL_OFF,
n_levels
};
#if !defined(SPDLOG_LEVEL_NAMES)

View File

@ -111,7 +111,7 @@ SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::set_color_mode(color_mode mode)
template<typename ConsoleMutex>
SPDLOG_INLINE void ansicolor_sink<ConsoleMutex>::print_ccode_(const string_view_t &color_code)
{
fwrite(color_code.data(), sizeof(string_view_t::char_type), color_code.size(), target_file_);
fwrite(color_code.data(), sizeof(char), color_code.size(), target_file_);
}
template<typename ConsoleMutex>

View File

@ -9,7 +9,7 @@
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
#include <array>
namespace spdlog {
namespace sinks {
@ -80,7 +80,7 @@ private:
mutex_t &mutex_;
bool should_do_colors_;
std::unique_ptr<spdlog::formatter> formatter_;
std::unordered_map<level::level_enum, string_view_t, level::level_hasher> colors_;
std::array<string_view_t , level::n_levels> colors_;
void print_ccode_(const string_view_t &color_code);
void print_range_(const memory_buf_t &formatted, size_t start, size_t end);
};

View File

@ -219,7 +219,7 @@ protected:
using namespace internal;
memory_buf_t formatted;
formatter_->format(msg, formatted);
base_sink<Mutex>::formatter_->format(msg, formatted);
formatted.push_back('\0');
LPCSTR lp_str = static_cast<LPCSTR>(formatted.data());

View File

@ -11,7 +11,7 @@
#include <memory>
#include <mutex>
#include <string>
#include <unordered_map>
#include <array>
#include <wincon.h>
namespace spdlog {
@ -52,7 +52,7 @@ protected:
bool in_console_;
bool should_do_colors_;
std::unique_ptr<spdlog::formatter> formatter_;
std::unordered_map<level::level_enum, WORD, level::level_hasher> colors_;
std::array<WORD , level::n_levels> colors_;
// set foreground color and return the orig console attributes (for resetting later)
WORD set_foreground_color_(WORD attribs);

View File

@ -13,7 +13,7 @@ readability-*,\
clang-analyzer-*'
WarningsAsErrors: ''
HeaderFilterRegex: 'async.h|async_logger.h|common.h|details|formatter.h|logger.h|sinks|spdlog.h|tweakme.h|version.h'
HeaderFilterRegex: 'include/spdlog/[^f].*'
AnalyzeTemporaryDtors: false
FormatStyle: none