From 9b9556fb69eadb30585260a809d22080655c92e1 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:16:15 +0200 Subject: [PATCH 01/18] Update README.md --- README.md | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/README.md b/README.md index ec66d00e..0141f21a 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,9 @@ Very fast, header only, C++ logging library. - ## Install Just copy the files to your build tree and use a C++11 compiler - ## Tested on: * gcc 4.8.1 and above * clang 3.5 @@ -38,7 +36,7 @@ Just copy the files to your build tree and use a C++11 compiler Below are some [benchmarks](bench) comparing the time needed to log 1,000,000 lines to file under Ubuntu 64 bit, Intel i7-4770 CPU @ 3.40GHz (the best of 3 runs for each logger): -|threads|boost log|glog|g2log|spdlog|spdlog async mode| +|threads|boost log|glog|g2logasync mode|spdlog|spdlog async mode| |-------|:-------:|:-----:|------:|------:|------:| |1|4.779s|1.109s|3.155s|0.319s|0.212s |10|15.151ss|3.546s|3.500s|0.641s|0.199s| @@ -51,23 +49,19 @@ Below are some [benchmarks](bench) comparing the time needed to log 1,000,000 li int main(int, char* []) { - namespace spd = spdlog; - try { std::string filename = "logs/spdlog_example"; // Set log level to all loggers to DEBUG and above spd::set_level(spd::level::DEBUG); - //Create console, multithreaded logger auto console = spd::stdout_logger_mt("console"); console->info("Welcome to spdlog!") ; console->info("An info message example {}..", 1); console->info() << "Streams are supported too " << 1; - console->info("Easy padding in numbers like {:08d}", 12); console->info("Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42); console->info("Support for floats {:03.2f}", 1.23456); @@ -81,7 +75,6 @@ int main(int, char* []) auto file_logger = spd::rotating_logger_mt("file_logger", filename, 1024 * 1024 * 5, 3); file_logger->info("Log file message number", 1); - spd::set_pattern("*** [%H:%M:%S %z] [thread %t] %v ***"); file_logger->info("This is another message with custom format"); @@ -110,7 +103,6 @@ int main(int, char* []) { std::cout << "Log failed: " << ex.what() << std::endl; } - return 0; } ``` From 06ce050ab05666aa575cd168521933084c02238d Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:18:28 +0200 Subject: [PATCH 02/18] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0141f21a..d1d63a39 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ Just copy the files to your build tree and use a C++11 compiler * Headers only. * No dependencies. * Cross platform - Linux / Windows on 32/64 bits. -* **new**! Feature rich [cppfromat call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library:```logger.info("Hello {} !!", "world");``` +* **new**! Feature rich [cppfromat call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library: +* ```logger.info("Hello {} !!", "world");``` * ostream call style ```logger.info() << "Hello << "logger";``` * Mixed cppformat/ostream call style ```logger.info("{} + {} = ", 1, 2) << "?";``` * [Custom](https://github.com/gabime/spdlog/wiki/Custom-formatting) formatting. From c55a0c89749194f2939bace3b6b4f57083a30e03 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:23:53 +0200 Subject: [PATCH 03/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d1d63a39..c0a3c299 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Just copy the files to your build tree and use a C++11 compiler * Headers only. * No dependencies. * Cross platform - Linux / Windows on 32/64 bits. -* **new**! Feature rich [cppfromat call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library: +* **new**! Feature rich cppfromat [call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library: * ```logger.info("Hello {} !!", "world");``` * ostream call style ```logger.info() << "Hello << "logger";``` * Mixed cppformat/ostream call style ```logger.info("{} + {} = ", 1, 2) << "?";``` From a0d92cb58a416df9cc719328702b153bd7dd4a04 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:25:45 +0200 Subject: [PATCH 04/18] Update README.md --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index c0a3c299..45b206f5 100644 --- a/README.md +++ b/README.md @@ -72,6 +72,10 @@ int main(int, char* []) console->info("{:>30}", "right aligned"); console->info("{:^30}", "centered"); + //See full cppformat documation here: + //http://cppformat.readthedocs.org/en/stable/syntax.html + + //Create a file rotating logger with 5mb size max and 3 rotated files auto file_logger = spd::rotating_logger_mt("file_logger", filename, 1024 * 1024 * 5, 3); file_logger->info("Log file message number", 1); From 9d3e2d1fa8dac365f28670bd1c931424dc796ccc Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:26:33 +0200 Subject: [PATCH 05/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 45b206f5..7de2ab2b 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ int main(int, char* []) console->info("{:>30}", "right aligned"); console->info("{:^30}", "centered"); - //See full cppformat documation here: + //See cppformat syntax documation here: //http://cppformat.readthedocs.org/en/stable/syntax.html From 007e7eee828985493050705549f63b36a24e4bc1 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:27:40 +0200 Subject: [PATCH 06/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7de2ab2b..3607e16e 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ Just copy the files to your build tree and use a C++11 compiler * mingw with g++ 4.9.x ##Features -* Very fast - performance is the primary goal (see becnhmarks below). +* Very fast - performance is the primary goal (see [becnhmarks](#benchmarks) below). * Headers only. * No dependencies. * Cross platform - Linux / Windows on 32/64 bits. From 6c60db188b15504b48e21dea70381bc573d57f04 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:34:51 +0200 Subject: [PATCH 07/18] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3607e16e..e2843601 100644 --- a/README.md +++ b/README.md @@ -16,19 +16,19 @@ Just copy the files to your build tree and use a C++11 compiler * Headers only. * No dependencies. * Cross platform - Linux / Windows on 32/64 bits. -* **new**! Feature rich cppfromat [call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library: +* **new!** Feature rich cppfromat [call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library: * ```logger.info("Hello {} !!", "world");``` * ostream call style ```logger.info() << "Hello << "logger";``` * Mixed cppformat/ostream call style ```logger.info("{} + {} = ", 1, 2) << "?";``` * [Custom](https://github.com/gabime/spdlog/wiki/Custom-formatting) formatting. * Multi/Single threaded loggers. +* **new!** Extremly fast option; async logging using lockfree queues * Various log targets: * Rotating log files. * Daily log files. * Console logging. * Linux syslog. * Easily extendable with custom log targets (just implement a single function in the [sink](include/spdlog/sinks/sink.h) interface). -* Optional, (extremly fast!), async logging. * Log levels. From 830c77270b67909656b21b85d1d714e74124c970 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:36:54 +0200 Subject: [PATCH 08/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index e2843601..5c2175ed 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Just copy the files to your build tree and use a C++11 compiler * Mixed cppformat/ostream call style ```logger.info("{} + {} = ", 1, 2) << "?";``` * [Custom](https://github.com/gabime/spdlog/wiki/Custom-formatting) formatting. * Multi/Single threaded loggers. -* **new!** Extremly fast option; async logging using lockfree queues +* **new!** Extremly fast asynchronous logging(optional) using lockfree queues * Various log targets: * Rotating log files. * Daily log files. From ab5169e028704e0c2b04b445363262d02b41f4fb Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:38:05 +0200 Subject: [PATCH 09/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 5c2175ed..d3f2b626 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ Just copy the files to your build tree and use a C++11 compiler * Mixed cppformat/ostream call style ```logger.info("{} + {} = ", 1, 2) << "?";``` * [Custom](https://github.com/gabime/spdlog/wiki/Custom-formatting) formatting. * Multi/Single threaded loggers. -* **new!** Extremly fast asynchronous logging(optional) using lockfree queues +* **new!** Extremly fast asynchronous logging(optional) using lockfree queues and finely tuned implementation * Various log targets: * Rotating log files. * Daily log files. From 6c5dc5a6c127ef0d4d2cf4a66fadd355dd48a10e Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:40:17 +0200 Subject: [PATCH 10/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d3f2b626..1ef7eea1 100644 --- a/README.md +++ b/README.md @@ -20,9 +20,9 @@ Just copy the files to your build tree and use a C++11 compiler * ```logger.info("Hello {} !!", "world");``` * ostream call style ```logger.info() << "Hello << "logger";``` * Mixed cppformat/ostream call style ```logger.info("{} + {} = ", 1, 2) << "?";``` +* **new!** Extremly fast asynchronous logging (optional) using lockfree queues. * [Custom](https://github.com/gabime/spdlog/wiki/Custom-formatting) formatting. * Multi/Single threaded loggers. -* **new!** Extremly fast asynchronous logging(optional) using lockfree queues and finely tuned implementation * Various log targets: * Rotating log files. * Daily log files. From ce5c75065f4a97c3af39ac4fa12f7a4b98e3c7dd Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:40:59 +0200 Subject: [PATCH 11/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ef7eea1..44e9442c 100644 --- a/README.md +++ b/README.md @@ -37,7 +37,7 @@ Just copy the files to your build tree and use a C++11 compiler Below are some [benchmarks](bench) comparing the time needed to log 1,000,000 lines to file under Ubuntu 64 bit, Intel i7-4770 CPU @ 3.40GHz (the best of 3 runs for each logger): -|threads|boost log|glog|g2logasync mode|spdlog|spdlog async mode| +|threads|boost log|glog|g2log async mode|spdlog|spdlog async mode| |-------|:-------:|:-----:|------:|------:|------:| |1|4.779s|1.109s|3.155s|0.319s|0.212s |10|15.151ss|3.546s|3.500s|0.641s|0.199s| From c615ac32bd238d1f8188b3163f3b024fb3fe2499 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:44:16 +0200 Subject: [PATCH 12/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 44e9442c..732afda0 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Just copy the files to your build tree and use a C++11 compiler * ```logger.info("Hello {} !!", "world");``` * ostream call style ```logger.info() << "Hello << "logger";``` * Mixed cppformat/ostream call style ```logger.info("{} + {} = ", 1, 2) << "?";``` -* **new!** Extremly fast asynchronous logging (optional) using lockfree queues. +* **new!** Optional, extremly fast asynchronous mode using lockfree queues and deffered formatting. * [Custom](https://github.com/gabime/spdlog/wiki/Custom-formatting) formatting. * Multi/Single threaded loggers. * Various log targets: From 1899e6c481cdad364a0276861ba1c0b573db8f14 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:45:37 +0200 Subject: [PATCH 13/18] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 732afda0..d907ecbd 100644 --- a/README.md +++ b/README.md @@ -91,8 +91,8 @@ int main(int, char* []) // Asynchronous logging is easy.. // Just call spdlog::set_async_mode(max_q_size) and all created loggers from now on will be asynchronous.. // - size_t max_q_size = 1048576; - spdlog::set_async_mode(max_q_size); + size_t q_size = 1048576; //queue size must be power of 2 + spdlog::set_async_mode(q_size); auto async_file= spd::daily_logger_st("async_file_logger", "logs/async_log.txt"); async_file->info() << "This is async log.." << "Should be very fast!"; From 02827707986b9948c5e01f3916dc664fc2684c6a Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:46:18 +0200 Subject: [PATCH 14/18] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d907ecbd..2c00d755 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Just copy the files to your build tree and use a C++11 compiler * ```logger.info("Hello {} !!", "world");``` * ostream call style ```logger.info() << "Hello << "logger";``` * Mixed cppformat/ostream call style ```logger.info("{} + {} = ", 1, 2) << "?";``` -* **new!** Optional, extremly fast asynchronous mode using lockfree queues and deffered formatting. +* **new!** Optional, extremly fast asynchronous mode using lockfree queues, pre allocated memory and deffered formatting. * [Custom](https://github.com/gabime/spdlog/wiki/Custom-formatting) formatting. * Multi/Single threaded loggers. * Various log targets: From ebaf209f1147dec3d7be69a0eedfeb5d3dade9f2 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:47:10 +0200 Subject: [PATCH 15/18] Update README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index 2c00d755..9ffc6bc4 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,6 @@ Just copy the files to your build tree and use a C++11 compiler * **new!** Feature rich cppfromat [call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library: * ```logger.info("Hello {} !!", "world");``` * ostream call style ```logger.info() << "Hello << "logger";``` -* Mixed cppformat/ostream call style ```logger.info("{} + {} = ", 1, 2) << "?";``` * **new!** Optional, extremly fast asynchronous mode using lockfree queues, pre allocated memory and deffered formatting. * [Custom](https://github.com/gabime/spdlog/wiki/Custom-formatting) formatting. * Multi/Single threaded loggers. From f06f82b9a6e1cc65f6197a05a7acf7eb6940038a Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:47:43 +0200 Subject: [PATCH 16/18] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9ffc6bc4..8292902f 100644 --- a/README.md +++ b/README.md @@ -16,9 +16,8 @@ Just copy the files to your build tree and use a C++11 compiler * Headers only. * No dependencies. * Cross platform - Linux / Windows on 32/64 bits. -* **new!** Feature rich cppfromat [call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library: -* ```logger.info("Hello {} !!", "world");``` -* ostream call style ```logger.info() << "Hello << "logger";``` +* **new!** Feature rich cppfromat [call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library:```logger.info("Hello {} !!", "world");``` +* ostream call style: ```logger.info() << "Hello << "logger";``` * **new!** Optional, extremly fast asynchronous mode using lockfree queues, pre allocated memory and deffered formatting. * [Custom](https://github.com/gabime/spdlog/wiki/Custom-formatting) formatting. * Multi/Single threaded loggers. From 53ffeea35f425d17c6b789d02587cc9fb6590b43 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:49:44 +0200 Subject: [PATCH 17/18] Update README.md --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8292902f..f4a9e975 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,8 @@ Just copy the files to your build tree and use a C++11 compiler * Headers only. * No dependencies. * Cross platform - Linux / Windows on 32/64 bits. -* **new!** Feature rich cppfromat [call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library:```logger.info("Hello {} !!", "world");``` +* **new!** Feature rich cppfromat [call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library - +* cppformat call style ```logger.info("Hello {} {:08x}!!", "world", 42);``` * ostream call style: ```logger.info() << "Hello << "logger";``` * **new!** Optional, extremly fast asynchronous mode using lockfree queues, pre allocated memory and deffered formatting. * [Custom](https://github.com/gabime/spdlog/wiki/Custom-formatting) formatting. From 8213cd89d7af8682b54149fe2362c2092ad34999 Mon Sep 17 00:00:00 2001 From: Gabi Melman Date: Sun, 7 Dec 2014 06:51:04 +0200 Subject: [PATCH 18/18] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f4a9e975..2388c5a1 100644 --- a/README.md +++ b/README.md @@ -16,8 +16,8 @@ Just copy the files to your build tree and use a C++11 compiler * Headers only. * No dependencies. * Cross platform - Linux / Windows on 32/64 bits. -* **new!** Feature rich cppfromat [call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library - -* cppformat call style ```logger.info("Hello {} {:08x}!!", "world", 42);``` +* **new!** Feature rich cppfromat [call style](http://cppformat.readthedocs.org/en/stable/syntax.html) using the excellent [cppformat](http://cppformat.github.io/) library. +* Example: ```logger.info("Hello {} {:08x}!!", "world", 42);``` * ostream call style: ```logger.info() << "Hello << "logger";``` * **new!** Optional, extremly fast asynchronous mode using lockfree queues, pre allocated memory and deffered formatting. * [Custom](https://github.com/gabime/spdlog/wiki/Custom-formatting) formatting.