mirror of
https://github.com/gabime/spdlog.git
synced 2025-10-01 02:49:03 +08:00
clang format
This commit is contained in:
@@ -5,10 +5,10 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "spdlog/details/fmt_helper.h"
|
||||
#include "spdlog/details/null_mutex.h"
|
||||
#include "spdlog/details/os.h"
|
||||
#include "spdlog/sinks/base_sink.h"
|
||||
#include "spdlog/details/null_mutex.h"
|
||||
#include "spdlog/details/fmt_helper.h"
|
||||
|
||||
#include <android/log.h>
|
||||
#include <chrono>
|
||||
@@ -27,7 +27,7 @@ namespace sinks {
|
||||
* Android sink (logging using __android_log_write)
|
||||
*/
|
||||
template<typename Mutex>
|
||||
class android_sink SPDLOG_FINAL: public base_sink<Mutex>
|
||||
class android_sink SPDLOG_FINAL : public base_sink<Mutex>
|
||||
{
|
||||
public:
|
||||
explicit android_sink(const std::string &tag = "spdlog", bool use_raw_msg = false)
|
||||
@@ -68,9 +68,7 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
void flush_() override
|
||||
{
|
||||
}
|
||||
void flush_() override {}
|
||||
|
||||
private:
|
||||
static android_LogPriority convert_to_android_(spdlog::level::level_enum level)
|
||||
@@ -117,5 +115,3 @@ inline std::shared_ptr<logger> android_logger_st(const std::string &logger_name,
|
||||
}
|
||||
|
||||
} // namespace spdlog
|
||||
|
||||
|
||||
|
@@ -18,7 +18,8 @@ namespace spdlog {
|
||||
namespace sinks {
|
||||
|
||||
/**
|
||||
* This sink prefixes the output with an ANSI escape sequence color code depending on the severity
|
||||
* This sink prefixes the output with an ANSI escape sequence color code
|
||||
* depending on the severity
|
||||
* of the message.
|
||||
* If no color terminal detected, omit the escape codes.
|
||||
*/
|
||||
|
@@ -7,7 +7,8 @@
|
||||
//
|
||||
// base sink templated over a mutex (either dummy or real)
|
||||
// concrete implementation should override the sink_it_() and flush_() methods.
|
||||
// locking is taken care of in this class - no locking needed by the implementers..
|
||||
// locking is taken care of in this class - no locking needed by the
|
||||
// implementers..
|
||||
//
|
||||
|
||||
#include "spdlog/common.h"
|
||||
|
@@ -84,7 +84,7 @@ private:
|
||||
return spdlog::details::os::localtime(tnow);
|
||||
}
|
||||
|
||||
log_clock ::time_point next_rotation_tp_()
|
||||
log_clock::time_point next_rotation_tp_()
|
||||
{
|
||||
auto now = log_clock::now();
|
||||
tm date = now_tm(now);
|
||||
|
@@ -14,7 +14,8 @@
|
||||
#include <mutex>
|
||||
#include <vector>
|
||||
|
||||
// Distribution sink (mux). Stores a vector of sinks which get called when log is called
|
||||
// Distribution sink (mux). Stores a vector of sinks which get called when log
|
||||
// is called
|
||||
|
||||
namespace spdlog {
|
||||
namespace sinks {
|
||||
|
@@ -29,7 +29,7 @@ public:
|
||||
protected:
|
||||
void sink_it_(const details::log_msg &msg) override
|
||||
{
|
||||
|
||||
|
||||
fmt::memory_buffer formatted;
|
||||
sink::formatter_->format(msg, formatted);
|
||||
OutputDebugStringA(fmt::to_string(formatted).c_str());
|
||||
|
@@ -98,7 +98,8 @@ private:
|
||||
if (details::file_helper::file_exists(src) && details::os::rename(src, target) != 0)
|
||||
{
|
||||
// if failed try again after small delay.
|
||||
// this is a workaround to a windows issue, where very high rotation rates sometimes fail (because of antivirus?).
|
||||
// this is a workaround to a windows issue, where very high rotation
|
||||
// rates sometimes fail (because of antivirus?).
|
||||
details::os::sleep_for_millis(20);
|
||||
details::os::remove(target);
|
||||
if (details::os::rename(src, target) != 0)
|
||||
|
@@ -57,7 +57,8 @@ protected:
|
||||
|
||||
private:
|
||||
std::array<int, 7> priorities_;
|
||||
// must store the ident because the man says openlog might use the pointer as is and not a string copy
|
||||
// must store the ident because the man says openlog might use the pointer as
|
||||
// is and not a string copy
|
||||
const std::string ident_;
|
||||
|
||||
//
|
||||
|
@@ -19,7 +19,8 @@
|
||||
namespace spdlog {
|
||||
namespace sinks {
|
||||
/*
|
||||
* Windows color console sink. Uses WriteConsoleA to write to the console with colors
|
||||
* Windows color console sink. Uses WriteConsoleA to write to the console with
|
||||
* colors
|
||||
*/
|
||||
template<typename OutHandle, typename ConsoleMutex>
|
||||
class wincolor_sink : public sink
|
||||
@@ -73,8 +74,9 @@ public:
|
||||
// in color range
|
||||
auto orig_attribs = set_console_attribs(colors_[msg.level]);
|
||||
print_range_(formatted, msg.color_range_start, msg.color_range_end);
|
||||
::SetConsoleTextAttribute(out_handle_, orig_attribs); // reset to orig colors
|
||||
// after color range
|
||||
::SetConsoleTextAttribute(out_handle_,
|
||||
orig_attribs); // reset to orig colors
|
||||
// after color range
|
||||
print_range_(formatted, msg.color_range_end, formatted.size());
|
||||
}
|
||||
else // print without colors if color range is invalid
|
||||
|
Reference in New Issue
Block a user