If you want to make your software logs LIKE A PRO, then SpdLog is the best option!
It is a fast and complete C++ library for creating logs.
Installation
It is already available in the repository of most operating systems, so to install it simply use the package manager corresponding to your case:
- vcpkg:
vcpkg install spdlog
- conan:
spdlog/[>=1.4.1]
- Homebrew:
brew install spdlog
- MacPorts:
sudo port install spdlog
- Debian:
sudo apt install libspdlog-dev
- FreeBSD:
pkg install spdlog
- Fedora:
dnf install spdlog
- Gentoo:
emerge dev-libs/spdlog
- Arch Linux:
sudo pacman -S spdlog
- openSUSE:
sudo zypper in spdlog-devel
- conda:
conda install -c conda-forge spdlog
- build2: depends:
spdlog ^1.8.2
But, if you want to compile and install manually, run the commands below:
Remembering that you need to have libfmt installed, as SpdLog uses it like addiction!
Using
Its use can be applied in different situations, the most basic way is the example below:
main.cpp
To compile run without additional flags:
For more information, visit the repository.
cpp
cppdaily
Marcos Oliveira
Software developer