Logging utilities.
- Linux
- Abseil (Apache 2.0 License)
- ctre (Apache 2.0 License)
- fmt (MIT License)
- libunwind (MIT License)
- spdlog (MIT License)
Optional
- Catch2 (Boost Software License 1.0 License)
The project is designed to be compatible with the conda package manager.
wget -N https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh
bash Miniforge3-Linux-x86_64.sh -b -u -p ~/conda
source ~/conda/bin/activate
conda install -y \
git \
cmake \
gxx_linux-64 \
abseil-cpp \
fmt \
spdlog
conda install -y --channel https://roq-trading.com/conda/stable \
roq-oss-ctre \
roq-oss-libunwind \
roq-api
git submodule update --init --recursive
cmake .
make -j4
make test
A pre-compiled binary package can be downloaded from Roq's conda package repository
conda install -y --channel https://roq-trading.com/conda/stable \
roq-logging
#include <cstdlib>
#include "roq/logging.h"
void foo(int i) {
// only log when the ROQ_v environment variable has been set to 1 (or higher)
VLOG(1)("enter foo")
// always log
LOG(INFO)("foo called with i={}", i);
// conditional log a warning
LOG_IF(WARNING, i > 10)("value exceeds threshold");
// terminate the process with a stacktrace
LOG(FATAL)("something is wrong");
}
int main(int argc, const char *argv[]) {
roq::Logger::initialize(argv[0]);
foo(argc);
roq::Logger::shutdown();
return EXIT_SUCCESS;
}
The interface is somewhat inspired by
- glog (BSD 3-Clause License)
The project is released under the terms of the MIT license.