Logging Library

// for the tutorials, the
// PRESSIO_LOG_ACTIVE_MIN_LEVEL is set to 2 (=info)

// this is needed to include the logger code
#include <pressio/utils.hpp>

int main(int argc, char *argv[])
{
  namespace plog = pressio::log;
  plog::initialize(pressio::logto::terminal);

  /* recall that:
  PRESSIO_LOG_LEVEL_TRACE     0
  PRESSIO_LOG_LEVEL_DEBUG     1
  PRESSIO_LOG_LEVEL_INFO      2
  PRESSIO_LOG_LEVEL_WARN      3
  PRESSIO_LOG_LEVEL_ERROR     4
  PRESSIO_LOG_LEVEL_CRITICAL  5
  PRESSIO_LOG_LEVEL_OFF       6
  */

  PRESSIOLOG_INFO( "prints because info is == PRESSIO_LOG_ACTIVE_MIN_LEVEL");
  PRESSIOLOG_DEBUG("this should NOT print because debug < PRESSIO_LOG_ACTIVE_MIN_LEVEL");
  PRESSIOLOG_WARN( "this should print print because warn > PRESSIO_LOG_ACTIVE_MIN_LEVEL");
  PRESSIOLOG_ERROR("this should print print because error > PRESSIO_LOG_ACTIVE_MIN_LEVEL");

  double a = 1.1;
  PRESSIOLOG_INFO( "logger uses fmtlibrary so you can do a= {:.6e}", a);

  plog::setVerbosity({plog::level::warn});
  PRESSIOLOG_INFO( "this should NOT print because we reset min level");

  plog::finalize();
  return 0;
}