Commit a7ba6e44 authored by gabime's avatar gabime

clang-format

parent baa978ab
......@@ -205,7 +205,6 @@ SPDLOG_INLINE bool logger::should_flush_(const details::log_msg &msg)
return (msg.level >= flush_level) && (msg.level != level::off);
}
SPDLOG_INLINE void logger::err_handler_(const std::string &msg)
{
......@@ -222,7 +221,7 @@ SPDLOG_INLINE void logger::err_handler_(const std::string &msg)
std::lock_guard<std::mutex> lk{mutex};
auto now = system_clock::now();
err_counter++;
if(now - last_report_time < std::chrono::seconds(1))
if (now - last_report_time < std::chrono::seconds(1))
{
return;
}
......
......@@ -24,9 +24,15 @@
#include <vector>
#define SPDLOG_LOGGER_CATCH() \
catch (const std::exception &ex) { err_handler_(ex.what());} \
catch (...) {err_handler_("Unknown exception in logger");}
#define SPDLOG_LOGGER_CATCH() \
catch (const std::exception &ex) \
{ \
err_handler_(ex.what()); \
} \
catch (...) \
{ \
err_handler_("Unknown exception in logger"); \
}
namespace spdlog {
class logger
......
......@@ -71,8 +71,6 @@ std::shared_ptr<logger> stderr_logger_st(const std::string &logger_name);
} // namespace spdlog
#ifdef SPDLOG_HEADER_ONLY
#include "stdout_sinks-inl.h"
#endif
......@@ -68,8 +68,8 @@ void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::log(const details::log_msg &msg)
// in color range
auto orig_attribs = set_foreground_color_(colors_[msg.level]);
print_range_(formatted, msg.color_range_start, msg.color_range_end);
// reset to orig colors
::SetConsoleTextAttribute(out_handle_, orig_attribs);
// reset to orig colors
::SetConsoleTextAttribute(out_handle_, orig_attribs);
print_range_(formatted, msg.color_range_end, formatted.size());
}
else // print without colors if color range is invalid (or color is disabled)
......@@ -149,12 +149,12 @@ void SPDLOG_INLINE wincolor_sink<ConsoleMutex>::write_to_file_(const fmt::memory
DWORD total_written = 0;
do
{
DWORD bytes_written = 0;
bool ok = ::WriteFile(out_handle_, formatted.data()+total_written, size-total_written, &bytes_written, nullptr) != 0;
DWORD bytes_written = 0;
bool ok = ::WriteFile(out_handle_, formatted.data() + total_written, size - total_written, &bytes_written, nullptr) != 0;
if (!ok || bytes_written == 0)
{
throw spdlog_ex("wincolor_sink: write_to_file_ failed. GetLastError(): " + std::to_string(::GetLastError()));
}
}
total_written += bytes_written;
} while (total_written < size);
}
......
......@@ -80,8 +80,6 @@ template std::shared_ptr<spdlog::logger> spdlog::stdout_color_st<spdlog::async_f
template std::shared_ptr<spdlog::logger> spdlog::stderr_color_mt<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
template std::shared_ptr<spdlog::logger> spdlog::stderr_color_st<spdlog::async_factory>(const std::string &logger_name, color_mode mode);
#include "spdlog/sinks/stdout_sinks-inl.h"
template class spdlog::sinks::stdout_sink_base<spdlog::details::console_mutex>;
......@@ -101,7 +99,6 @@ template std::shared_ptr<spdlog::logger> spdlog::stdout_logger_st<spdlog::async_
template std::shared_ptr<spdlog::logger> spdlog::stderr_logger_mt<spdlog::async_factory>(const std::string &logger_name);
template std::shared_ptr<spdlog::logger> spdlog::stderr_logger_st<spdlog::async_factory>(const std::string &logger_name);
// Slightly modified version of fmt lib's format.cc source file.
// Copyright (c) 2012 - 2016, Victor Zverovich
// All rights reserved.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment