mirror of
https://github.com/gabime/spdlog.git
synced 2024-11-15 16:35:45 +08:00
clang-format
This commit is contained in:
parent
261d2c5ae4
commit
5f27697198
@ -39,7 +39,6 @@ int main(int argc, char *argv[])
|
|||||||
size_t file_size = 30 * 1024 * 1024;
|
size_t file_size = 30 * 1024 * 1024;
|
||||||
size_t rotating_files = 5;
|
size_t rotating_files = 5;
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -23,6 +23,7 @@ void clone_example();
|
|||||||
|
|
||||||
int main(int, char *[])
|
int main(int, char *[])
|
||||||
{
|
{
|
||||||
|
syslog_example();
|
||||||
spdlog::info("Welcome to spdlog version {}.{}.{} !", SPDLOG_VER_MAJOR, SPDLOG_VER_MINOR, SPDLOG_VER_PATCH);
|
spdlog::info("Welcome to spdlog version {}.{}.{} !", SPDLOG_VER_MAJOR, SPDLOG_VER_MINOR, SPDLOG_VER_PATCH);
|
||||||
spdlog::warn("Easy padding in numbers like {:08d}", 12);
|
spdlog::warn("Easy padding in numbers like {:08d}", 12);
|
||||||
spdlog::critical("Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42);
|
spdlog::critical("Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42);
|
||||||
|
@ -892,13 +892,12 @@ public:
|
|||||||
template<typename Units>
|
template<typename Units>
|
||||||
class elapsed_formatter final : public flag_formatter
|
class elapsed_formatter final : public flag_formatter
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
using DurationUnits = Units;
|
using DurationUnits = Units;
|
||||||
|
|
||||||
explicit elapsed_formatter(padding_info padinfo)
|
explicit elapsed_formatter(padding_info padinfo)
|
||||||
: flag_formatter(padinfo),
|
: flag_formatter(padinfo)
|
||||||
last_message_time_(log_clock::now())
|
, last_message_time_(log_clock::now())
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
void format(const details::log_msg &msg, const std::tm &, fmt::memory_buffer &dest) override
|
||||||
@ -919,7 +918,6 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
log_clock::time_point last_message_time_;
|
log_clock::time_point last_message_time_;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Full info formatter
|
// Full info formatter
|
||||||
|
@ -33,7 +33,6 @@
|
|||||||
// [2019-06-25 17:50:56.512] [logger] [info] Skipped 3 duplicate messages..
|
// [2019-06-25 17:50:56.512] [logger] [info] Skipped 3 duplicate messages..
|
||||||
// [2019-06-25 17:50:56.512] [logger] [info] Different Hello
|
// [2019-06-25 17:50:56.512] [logger] [info] Different Hello
|
||||||
|
|
||||||
|
|
||||||
#ifdef SPDLOG_NO_DATETIME
|
#ifdef SPDLOG_NO_DATETIME
|
||||||
#error "spdlog::sinks::dup_filter_sink: cannot work when SPDLOG_NO_DATETIME is defined"
|
#error "spdlog::sinks::dup_filter_sink: cannot work when SPDLOG_NO_DATETIME is defined"
|
||||||
#endif
|
#endif
|
||||||
|
@ -61,7 +61,7 @@ protected:
|
|||||||
|
|
||||||
size_t length = payload.size();
|
size_t length = payload.size();
|
||||||
// limit to max int
|
// limit to max int
|
||||||
if(length > std::numeric_limits<int>::max())
|
if (length > std::numeric_limits<int>::max())
|
||||||
{
|
{
|
||||||
length = std::numeric_limits<int>::max();
|
length = std::numeric_limits<int>::max();
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ protected:
|
|||||||
|
|
||||||
size_t length = msg.payload.size();
|
size_t length = msg.payload.size();
|
||||||
// limit to max int
|
// limit to max int
|
||||||
if(length > std::numeric_limits<int>::max())
|
if (length > std::numeric_limits<int>::max())
|
||||||
{
|
{
|
||||||
length = std::numeric_limits<int>::max();
|
length = std::numeric_limits<int>::max();
|
||||||
}
|
}
|
||||||
@ -60,9 +60,8 @@ protected:
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
err = (sd_journal_send)("MESSAGE=%.*s", static_cast<int>(length), msg.payload.data(), "PRIORITY=%d",
|
err = (sd_journal_send)("MESSAGE=%.*s", static_cast<int>(length), msg.payload.data(), "PRIORITY=%d", syslog_level(msg.level),
|
||||||
syslog_level(msg.level), "SOURCE_FILE=%s", msg.source.filename, "SOURCE_LINE=%d", msg.source.line, "SOURCE_FUNC=%s",
|
"SOURCE_FILE=%s", msg.source.filename, "SOURCE_LINE=%d", msg.source.line, "SOURCE_FUNC=%s", msg.source.funcname, nullptr);
|
||||||
msg.source.funcname, nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
|
Loading…
Reference in New Issue
Block a user