From 8650c1574971bc070ab2eb1607a2eb349935e5b6 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Fri, 3 Feb 2017 14:44:03 +0200 Subject: [PATCH 01/13] Updated install options section --- README.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index bca645c2..893982e3 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,16 @@ Very fast, header only, C++ logging library. [![Build Status](https://travis-ci. ## Install -Just copy the source [folder](https://github.com/gabime/spdlog/tree/master/include/spdlog) to your build tree and use a C++11 compiler +* Just copy the source [folder](https://github.com/gabime/spdlog/tree/master/include/spdlog) to your build tree and use a C++11 compiler. + +## Other Install Options +* Ubuntu: `apt-get install libspdlog-dev` +* Homebrew: `brew install spdlog` +* FreeBSD: `cd /usr/ports/devel/spdlog/ && make install clean` or `pkg install spdlog` +* Fedora: `yum install spdlog` +* Arch Linux: `pacman -S spdlog-git` +* vcpkg: `vcpkg install spdlog` + ## Platforms * Linux, FreeBSD, Solaris From 904bed92c30830509eda235d93d14f8f3fdaf8b9 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Fri, 3 Feb 2017 15:11:08 +0200 Subject: [PATCH 02/13] Added SPDLOG_VERSION macro to common.h --- include/spdlog/common.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index a0a227ef..03a7ca0d 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -5,6 +5,8 @@ #pragma once +#define SPDLOG_VERSION "0.11.0" + #include #include #include From a76a5cfc9c3dbe7611fff335729b82d9b6aa7cce Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Fri, 3 Feb 2017 15:19:23 +0200 Subject: [PATCH 03/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 893982e3..7929dc4e 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ Very fast, header only, C++ logging library. [![Build Status](https://travis-ci. ## Other Install Options * Ubuntu: `apt-get install libspdlog-dev` * Homebrew: `brew install spdlog` -* FreeBSD: `cd /usr/ports/devel/spdlog/ && make install clean` or `pkg install spdlog` +* FreeBSD: `cd /usr/ports/devel/spdlog/ && make install clean` * Fedora: `yum install spdlog` * Arch Linux: `pacman -S spdlog-git` * vcpkg: `vcpkg install spdlog` From 7481a8ecf763eebc7463e16ebb29578b1bf9b57b Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Fri, 3 Feb 2017 15:26:47 +0200 Subject: [PATCH 04/13] Update common.h --- include/spdlog/common.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/include/spdlog/common.h b/include/spdlog/common.h index 03a7ca0d..a0a227ef 100644 --- a/include/spdlog/common.h +++ b/include/spdlog/common.h @@ -5,8 +5,6 @@ #pragma once -#define SPDLOG_VERSION "0.11.0" - #include #include #include From 4f50c5d1432219de88f09d42853fade4deaab129 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Fri, 3 Feb 2017 15:27:06 +0200 Subject: [PATCH 05/13] Update spdlog.h --- include/spdlog/spdlog.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index b4bfc84e..92e36804 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -8,6 +8,8 @@ #pragma once +#define SPDLOG_VERSION "0.11.0" + #include #include #include From 054eb555ca0a37b5b75c36618dfc0d1be6295316 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Fri, 3 Feb 2017 15:28:32 +0200 Subject: [PATCH 06/13] Moved `SPDLOG_VERSION` macro to spdlog.h --- include/spdlog/spdlog.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index 92e36804..4f666718 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -2,7 +2,6 @@ // Copyright(c) 2015 Gabi Melman. // Distributed under the MIT License (http://opensource.org/licenses/MIT) // - // spdlog main header file. // see example.cpp for usage example From a626ebbbec9074cc6f9dde91d10e5683e8997d47 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Wed, 15 Feb 2017 14:31:51 +0100 Subject: [PATCH 07/13] Replace static global std::string arrays by Meyer singletons. This improves thread-safety. --- .../spdlog/details/pattern_formatter_impl.h | 31 +++++++++++++------ 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/include/spdlog/details/pattern_formatter_impl.h b/include/spdlog/details/pattern_formatter_impl.h index 3f4e9a2c..c170324c 100644 --- a/include/spdlog/details/pattern_formatter_impl.h +++ b/include/spdlog/details/pattern_formatter_impl.h @@ -18,6 +18,7 @@ #include #include #include +#include namespace spdlog { @@ -78,42 +79,54 @@ static int to12h(const tm& t) } //Abbreviated weekday name -static const std::string days[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; +static const auto& days() { + static std::array arr{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; + return arr; +} class a_formatter:public flag_formatter { void format(details::log_msg& msg, const std::tm& tm_time) override { - msg.formatted << days[tm_time.tm_wday]; + msg.formatted << days()[tm_time.tm_wday]; } }; //Full weekday name -static const std::string full_days[] { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; +static const auto& full_days() { + static std::array arr{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; + return arr; +} class A_formatter:public flag_formatter { void format(details::log_msg& msg, const std::tm& tm_time) override { - msg.formatted << full_days[tm_time.tm_wday]; + msg.formatted << full_days()[tm_time.tm_wday]; } }; //Abbreviated month -static const std::string months[] { "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" }; +static const auto& months() { + static std::array arr{ "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" }; + return arr; +} class b_formatter:public flag_formatter { void format(details::log_msg& msg, const std::tm& tm_time) override { - msg.formatted << months[tm_time.tm_mon]; + msg.formatted << months()[tm_time.tm_mon]; } }; //Full month name -static const std::string full_months[] { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; +static const auto& full_months() { + static std::array arr{ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; + return arr; +} class B_formatter:public flag_formatter { void format(details::log_msg& msg, const std::tm& tm_time) override { - msg.formatted << full_months[tm_time.tm_mon]; + msg.formatted << full_months()[tm_time.tm_mon]; } }; @@ -138,7 +151,7 @@ class c_formatter:public flag_formatter { void format(details::log_msg& msg, const std::tm& tm_time) override { - msg.formatted << days[tm_time.tm_wday] << ' ' << months[tm_time.tm_mon] << ' ' << tm_time.tm_mday << ' '; + msg.formatted << days()[tm_time.tm_wday] << ' ' << months()[tm_time.tm_mon] << ' ' << tm_time.tm_mday << ' '; pad_n_join(msg.formatted, tm_time.tm_hour, tm_time.tm_min, tm_time.tm_sec, ':') << ' ' << tm_time.tm_year + 1900; } }; From 06b8193a141588b32e0606574ba3e2bb7733d58a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Wed, 15 Feb 2017 14:41:57 +0100 Subject: [PATCH 08/13] Add missing consts --- include/spdlog/details/pattern_formatter_impl.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/spdlog/details/pattern_formatter_impl.h b/include/spdlog/details/pattern_formatter_impl.h index c170324c..95082022 100644 --- a/include/spdlog/details/pattern_formatter_impl.h +++ b/include/spdlog/details/pattern_formatter_impl.h @@ -80,7 +80,7 @@ static int to12h(const tm& t) //Abbreviated weekday name static const auto& days() { - static std::array arr{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; + static const std::array arr{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; return arr; } class a_formatter:public flag_formatter @@ -93,7 +93,7 @@ class a_formatter:public flag_formatter //Full weekday name static const auto& full_days() { - static std::array arr{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; + static const std::array arr{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; return arr; } class A_formatter:public flag_formatter @@ -106,7 +106,7 @@ class A_formatter:public flag_formatter //Abbreviated month static const auto& months() { - static std::array arr{ "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" }; + static const std::array arr{ "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" }; return arr; } class b_formatter:public flag_formatter @@ -119,7 +119,7 @@ class b_formatter:public flag_formatter //Full month name static const auto& full_months() { - static std::array arr{ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; + static const std::array arr{ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; return arr; } class B_formatter:public flag_formatter From b65c7bad9f1497a7ee13efa1807229a50e190f3a Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Thu, 16 Feb 2017 02:10:18 +0200 Subject: [PATCH 09/13] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7929dc4e..45c19254 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ Very fast, header only, C++ logging library. [![Build Status](https://travis-ci. ## Install * Just copy the source [folder](https://github.com/gabime/spdlog/tree/master/include/spdlog) to your build tree and use a C++11 compiler. -## Other Install Options +#### Or just use you favourite package manager: + * Ubuntu: `apt-get install libspdlog-dev` * Homebrew: `brew install spdlog` * FreeBSD: `cd /usr/ports/devel/spdlog/ && make install clean` From 20f4428696067f9bc271ca21b233fa477c5e3f7c Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Thu, 16 Feb 2017 02:12:50 +0200 Subject: [PATCH 10/13] Update README.md --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 45c19254..106cc730 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,11 @@ Very fast, header only, C++ logging library. [![Build Status](https://travis-ci. ## Install -* Just copy the source [folder](https://github.com/gabime/spdlog/tree/master/include/spdlog) to your build tree and use a C++11 compiler. +#### Just copy or clone the headers: -#### Or just use you favourite package manager: +* Copy the source [folder](https://github.com/gabime/spdlog/tree/master/include/spdlog) to your build tree and use a C++11 compiler. + +#### Or use your favourite package manager: * Ubuntu: `apt-get install libspdlog-dev` * Homebrew: `brew install spdlog` From ef665e959f35e5c4a26217f13501dad7cdf8e741 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Micha=C3=ABl=20Celerier?= Date: Thu, 16 Feb 2017 13:17:13 +0100 Subject: [PATCH 11/13] Don't deduce return types for days / months Required for C++11 support --- .../spdlog/details/pattern_formatter_impl.h | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/include/spdlog/details/pattern_formatter_impl.h b/include/spdlog/details/pattern_formatter_impl.h index 95082022..07895485 100644 --- a/include/spdlog/details/pattern_formatter_impl.h +++ b/include/spdlog/details/pattern_formatter_impl.h @@ -79,8 +79,9 @@ static int to12h(const tm& t) } //Abbreviated weekday name -static const auto& days() { - static const std::array arr{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; +using days_array = std::array; +static const days_array& days() { + static const days_array arr{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; return arr; } class a_formatter:public flag_formatter @@ -92,8 +93,8 @@ class a_formatter:public flag_formatter }; //Full weekday name -static const auto& full_days() { - static const std::array arr{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; +static const days_array& full_days() { + static const days_array arr{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; return arr; } class A_formatter:public flag_formatter @@ -105,8 +106,9 @@ class A_formatter:public flag_formatter }; //Abbreviated month -static const auto& months() { - static const std::array arr{ "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" }; +using months_array = std::array; +static const months_array& months() { + static const months_array arr{ "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" }; return arr; } class b_formatter:public flag_formatter @@ -118,8 +120,8 @@ class b_formatter:public flag_formatter }; //Full month name -static const auto& full_months() { - static const std::array arr{ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; +static const months_array& full_months() { + static const months_array arr{ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; return arr; } class B_formatter:public flag_formatter From 93d84e5d594b15be0abef4998cdd1a5be72db476 Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 17 Feb 2017 16:40:59 +0200 Subject: [PATCH 12/13] v0.12.0 --- include/spdlog/details/pattern_formatter_impl.h | 12 ++++++++---- include/spdlog/spdlog.h | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/include/spdlog/details/pattern_formatter_impl.h b/include/spdlog/details/pattern_formatter_impl.h index 07895485..2fefaa3c 100644 --- a/include/spdlog/details/pattern_formatter_impl.h +++ b/include/spdlog/details/pattern_formatter_impl.h @@ -80,7 +80,8 @@ static int to12h(const tm& t) //Abbreviated weekday name using days_array = std::array; -static const days_array& days() { +static const days_array& days() +{ static const days_array arr{ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; return arr; } @@ -93,7 +94,8 @@ class a_formatter:public flag_formatter }; //Full weekday name -static const days_array& full_days() { +static const days_array& full_days() +{ static const days_array arr{ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" }; return arr; } @@ -107,7 +109,8 @@ class A_formatter:public flag_formatter //Abbreviated month using months_array = std::array; -static const months_array& months() { +static const months_array& months() +{ static const months_array arr{ "Jan", "Feb", "Mar", "Apr", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec" }; return arr; } @@ -120,7 +123,8 @@ class b_formatter:public flag_formatter }; //Full month name -static const months_array& full_months() { +static const months_array& full_months() +{ static const months_array arr{ "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; return arr; } diff --git a/include/spdlog/spdlog.h b/include/spdlog/spdlog.h index 4f666718..6b93a7a1 100644 --- a/include/spdlog/spdlog.h +++ b/include/spdlog/spdlog.h @@ -7,7 +7,7 @@ #pragma once -#define SPDLOG_VERSION "0.11.0" +#define SPDLOG_VERSION "0.12.0" #include #include From d7a8db8f6357856c7ac1eb3bde1f3a90a9ab9e0c Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Tue, 21 Feb 2017 12:13:04 +0200 Subject: [PATCH 13/13] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 106cc730..ed3b6aa4 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Very fast, header only, C++ logging library. [![Build Status](https://travis-ci. ## Install -#### Just copy or clone the headers: +#### Just copy the headers: * Copy the source [folder](https://github.com/gabime/spdlog/tree/master/include/spdlog) to your build tree and use a C++11 compiler.