(third_party deps) fix #177, update bundled spdlog to 1.6.0
This commit is contained in:
		
							
								
								
									
										76
									
								
								third_party/spdlog/README.md
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										76
									
								
								third_party/spdlog/README.md
									
									
									
									
										vendored
									
									
								
							| @@ -1,8 +1,6 @@ | ||||
| # spdlog | ||||
|  | ||||
| Very fast, header-only/compiled, C++ logging library. [](https://travis-ci.org/gabime/spdlog)  [](https://ci.appveyor.com/project/gabime/spdlog) | ||||
|  | ||||
|  | ||||
| Very fast, header-only/compiled, C++ logging library. [](https://travis-ci.org/gabime/spdlog)  [](https://ci.appveyor.com/project/gabime/spdlog) [](https://github.com/gabime/spdlog/releases/latest) | ||||
|  | ||||
| ## Install  | ||||
| #### Header only version | ||||
| @@ -25,20 +23,22 @@ $ cmake .. && make -j | ||||
|  | ||||
| ## Package managers: | ||||
| * Homebrew: `brew install spdlog` | ||||
| * MacPorts: `sudo port install spdlog` | ||||
| * FreeBSD:  `cd /usr/ports/devel/spdlog/ && make install clean` | ||||
| * Fedora: `yum install spdlog` | ||||
| * Gentoo: `emerge dev-libs/spdlog` | ||||
| * Arch Linux: `yaourt -S spdlog-git` | ||||
| * Arch Linux: `pacman -S spdlog` | ||||
| * vcpkg: `vcpkg install spdlog` | ||||
| * conan: `spdlog/[>=1.4.1]@bincrafters/stable` | ||||
| * conan: `spdlog/[>=1.4.1]` | ||||
| * conda: `conda install -c conda-forge spdlog` | ||||
|  | ||||
|  | ||||
| ## Features | ||||
| * Very fast (see [benchmarks](#benchmarks) below). | ||||
| * Headers only, just copy and use. Or use as a compiled library. | ||||
| * Headers only or compiled version | ||||
| * Feature rich formatting, using the excellent [fmt](https://github.com/fmtlib/fmt) library. | ||||
| * **New!** [Backtrace](#backtrace-support) support - store debug or other messages in a ring buffer and display later on demand. | ||||
| * Fast asynchronous mode (optional) | ||||
| * **New!** [Backtrace](#backtrace-support) support - store debug messages in a ring buffer and display later on demand. | ||||
| * Asynchronous mode (optional) | ||||
| * [Custom](https://github.com/gabime/spdlog/wiki/3.-Custom-formatting) formatting. | ||||
| * Multi/Single threaded loggers. | ||||
| * Various log targets: | ||||
| @@ -48,7 +48,8 @@ $ cmake .. && make -j | ||||
|     * syslog. | ||||
|     * Windows debugger (```OutputDebugString(..)```) | ||||
|     * Easily extendable with custom log targets  (just implement a single function in the [sink](include/spdlog/sinks/sink.h) interface). | ||||
| * Severity based filtering - threshold levels can be modified in runtime as well as in compile time. | ||||
| * Log filtering - log levels can be modified in runtime as well as in compile time. | ||||
| * Support for loading log levels from argv or from environment var. | ||||
|  | ||||
|   | ||||
| ## Usage samples | ||||
| @@ -77,15 +78,30 @@ int main() | ||||
|      | ||||
|     // Compile time log levels | ||||
|     // define SPDLOG_ACTIVE_LEVEL to desired level | ||||
|     SPDLOG_TRACE("Some trace message with param {}", {}); | ||||
|     SPDLOG_TRACE("Some trace message with param {}", 42); | ||||
|     SPDLOG_DEBUG("Some debug message"); | ||||
|      | ||||
|     // Set the default logger to file logger | ||||
|     auto file_logger = spdlog::basic_logger_mt("basic_logger", "logs/basic.txt"); | ||||
|     spdlog::set_default_logger(file_logger);             | ||||
| } | ||||
|  | ||||
| ``` | ||||
| #### create stdout/stderr logger object | ||||
| #### Load log levels from env variable or from argv | ||||
| ```c++ | ||||
| #include "spdlog/cfg/env.h" | ||||
| void load_levels_example() | ||||
| { | ||||
|     // Set the log level to "info" and mylogger to to "trace": | ||||
|     // SPDLOG_LEVEL=info,mylogger=trace && ./example | ||||
|     spdlog::cfg::load_env_levels(); | ||||
|     // or from command line: | ||||
|     // ./example SPDLOG_LEVEL=info,mylogger=trace | ||||
|     // #include "spdlog/cfg/argv.h" // for loading levels from argv | ||||
|     // spdlog::cfg::load_argv_levels(args, argv); | ||||
| } | ||||
| ``` | ||||
| #### Create stdout/stderr logger object | ||||
| ```c++ | ||||
| #include "spdlog/spdlog.h" | ||||
| #include "spdlog/sinks/stdout_color_sinks.h" | ||||
| @@ -158,7 +174,7 @@ spdlog::dump_backtrace(); // log them now! show the last 32 messages | ||||
| #### Periodic flush | ||||
| ```c++ | ||||
| // periodically flush all *registered* loggers every 3 seconds: | ||||
| // warning: only use if all your loggers are thread safe! | ||||
| // warning: only use if all your loggers are thread safe ("_mt" loggers) | ||||
| spdlog::flush_every(std::chrono::seconds(3)); | ||||
|  | ||||
| ``` | ||||
| @@ -266,6 +282,37 @@ void user_defined_example() | ||||
| } | ||||
|  | ||||
| ``` | ||||
|  | ||||
| --- | ||||
| #### User defined flags in the log pattern | ||||
| ```c++  | ||||
| // Log patterns can contain custom flags. | ||||
| // the following example will add new flag '%*' - which will be bound to a <my_formatter_flag> instance. | ||||
| #include "spdlog/pattern_formatter.h" | ||||
| class my_formatter_flag : public spdlog::custom_flag_formatter | ||||
| { | ||||
| public: | ||||
|     void format(const spdlog::details::log_msg &, const std::tm &, spdlog::memory_buf_t &dest) override | ||||
|     { | ||||
|         std::string some_txt = "custom-flag"; | ||||
|         dest.append(some_txt.data(), some_txt.data() + some_txt.size()); | ||||
|     } | ||||
|  | ||||
|     std::unique_ptr<custom_flag_formatter> clone() const override | ||||
|     { | ||||
|         return spdlog::details::make_unique<my_formatter_flag>(); | ||||
|     } | ||||
| }; | ||||
|  | ||||
| void custom_flags_example() | ||||
| {     | ||||
|     auto formatter = std::make_unique<spdlog::pattern_formatter>(); | ||||
|     formatter->add_flag<my_formatter_flag>('*').set_pattern("[%n] [%*] [%^%l%$] %v"); | ||||
|     spdlog::set_formatter(std::move(formatter)); | ||||
| } | ||||
|  | ||||
| ``` | ||||
|  | ||||
| --- | ||||
| #### Custom error handler | ||||
| ```c++ | ||||
| @@ -277,6 +324,8 @@ void err_handler_example() | ||||
| } | ||||
|  | ||||
| ``` | ||||
|  | ||||
|  | ||||
| --- | ||||
| #### syslog  | ||||
| ```c++ | ||||
| @@ -321,7 +370,7 @@ Below are some [benchmarks](https://github.com/gabime/spdlog/blob/v1.x/bench/ben | ||||
| [info] daily_st         Elapsed: 0.42 secs        2,393,298/sec | ||||
| [info] null_st          Elapsed: 0.04 secs       27,446,957/sec | ||||
| [info] ************************************************************** | ||||
| [info] 10 threads sharing same logger, 1,000,000 iterations | ||||
| [info] 10 threads, competing over the same logger object, 1,000,000 iterations | ||||
| [info] ************************************************************** | ||||
| [info] basic_mt         Elapsed: 0.60 secs        1,659,613/sec | ||||
| [info] rotating_mt      Elapsed: 0.62 secs        1,612,493/sec | ||||
| @@ -335,7 +384,6 @@ Below are some [benchmarks](https://github.com/gabime/spdlog/blob/v1.x/bench/ben | ||||
| [info] Threads      : 10 | ||||
| [info] Queue        : 8,192 slots | ||||
| [info] Queue memory : 8,192 x 272 = 2,176 KB  | ||||
| [info] Total iters  : 3 | ||||
| [info] ------------------------------------------------- | ||||
| [info]  | ||||
| [info] ********************************* | ||||
|   | ||||
		Reference in New Issue
	
	Block a user