/log

Header-Only C++ Library for Really Simple Logging

Primary LanguageC++GNU General Public License v3.0GPL-3.0

Lyrahgames' Simple Log Package

C++ Header-Only Library Implementing a Really Simple Logging Mechanism

Development Status

master
Current

Requirements

Language Standard: C++20
Compiler: GCC | Clang
Build System: build2
Operating System: Linux
Dependencies: fmt
lyrahgames-xstd

Getting Started

#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.");
}

Usage with build2

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

Installation

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/*"

Alternative Usage

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.

Background

References