spdlog库
spdlog是基于C++11实现的一款纯头文件的日志管理库(git地址:GitHub - gabime/spdlog: Fast C++ logging library.,API说明:https://spdlog.docsforge.com/v1.x/1.quickstart/):
下载地址
https://github.com/gabime/spdlog
下载spdlog-1.14.1.zip版本
unzip spdlog-1.14.1.zip
root@ubuntu:~/share/gateway/app/openlib# cp spdlog-1.14.1/include/* /root/share/nuvoton_cross/host/usr/arm-nuvoton-linux-gnueabi/sysroot/usr/include/ -arf
github拷贝
spdlog
Very fast, header-only/compiled, C++ logging library.
Install
Header-only version
Copy the include folder to your build tree and use a C++11 compiler.
Compiled version (recommended - much faster compile times)
$ git clone https://github.com/gabime/spdlog.git $ cd spdlog && mkdir build && cd build $ cmake .. && make -j
see example CMakeLists.txt on how to use.
Platforms
- Linux, FreeBSD, OpenBSD, Solaris, AIX
- Windows (msvc 2013+, cygwin)
- macOS (clang 3.5+)
- Android
Package managers:
- Debian:
sudo apt install libspdlog-dev
- Homebrew:
brew install spdlog
- MacPorts:
sudo port install spdlog
- FreeBSD:
pkg install spdlog
- Fedora:
dnf install spdlog
- Gentoo:
emerge dev-libs/spdlog
- Arch Linux:
pacman -S spdlog
- openSUSE:
sudo zypper in spdlog-devel
- vcpkg:
vcpkg install spdlog
- conan:
spdlog/[>=1.4.1]
- conda:
conda install -c conda-forge spdlog
- build2:
depends: spdlog ^1.8.2
Features
- Very fast (see benchmarks below).
- Headers only or compiled
- Feature-rich formatting, using the excellent fmt library.
- Asynchronous mode (optional)
- Custom formatting.
- Multi/Single threaded loggers.
- Various log targets:
- Rotating log files.
- Daily log files.
- Console logging (colors supported).
- syslog.
- Windows event log.
- Windows debugger (
OutputDebugString(..)
). - Log to Qt widgets (example).
- Easily extendable with custom log targets.
- Log filtering - log levels can be modified at runtime as well as compile time.
- Support for loading log levels from argv or environment var.
- Backtrace support - store debug messages in a ring buffer and display them later on demand.