C++ Header-Only Library Implementing a Really Simple Logging Mechanism
master | |||
Current |
Language Standard: | C++20 |
Compiler: | GCC | Clang |
Build System: | build2 |
Operating System: | Linux |
Dependencies: |
fmt
lyrahgames-xstd |
#include <lyrahgames/log/log.hpp>
using namespace lyrahgames;
int main() {
log::log log{};
// log.quiet = true;
log.info("This is an information for the user.");
log.warning("This is a warning.");
log.error("This is an error.");
}
Add this repository to the repositories.manifest
file of your build2 package.
:
role: prerequisite
location: https://github.com/lyrahgames/log.git
Add the following entry to the manifest
file with a possible version dependency.
depends: lyrahgames-log
Add these entries to your buildfile
.
import libs = lyrahgames-log%lib{lyrahgames-log}
exe{your-executable}: {hxx cxx}{**} $libs
The standard installation process will only install the header-only library with some additional description, library, and package files.
bpkg -d build2-packages cc \
config.install.root=/usr/local \
config.install.sudo=sudo
Get the latest package release and build it.
bpkg build https://github.com/lyrahgames/log.git
Install the built package.
bpkg install lyrahgames-log
For uninstalling, do the following.
bpkg uninstall lyrahgames-log
If your package uses an explicit depends: lyrahgames-log
make sure to initialize this dependency as a system dependency when creating a new configuration.
bdep init -C @build cc config.cxx=g++ "config.cxx.coptions=-O3" -- "?sys:lyrahgames-log/*"
To use other build systems or manual compilation, you only have to add the lyrahgames/log/
directory to your project and include it in the compilation process.