view Samples/Common/SampleHelpers.h @ 1457:15173a383a00

fix
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 11 Jun 2020 21:12:02 +0200
parents dfb48f0794b1
children 828a9b4ee1b7
line wrap: on
line source

#pragma once

#include <Logging.h>

#include <boost/algorithm/string.hpp>

#include <string>
#include <iostream>

namespace OrthancStoneHelpers
{
  inline void SetLogLevel(std::string logLevel)
  {
    boost::to_lower(logLevel);
    if (logLevel == "warning")
    {
      Orthanc::Logging::EnableInfoLevel(false);
      Orthanc::Logging::EnableTraceLevel(false);
    }
    else if (logLevel == "info")
    {
      Orthanc::Logging::EnableInfoLevel(true);
      Orthanc::Logging::EnableTraceLevel(false);
    }
    else if (logLevel == "trace")
    {
      Orthanc::Logging::EnableInfoLevel(true);
      Orthanc::Logging::EnableTraceLevel(true);
    }
    else
    {
      std::cerr << "Unknown log level \"" << logLevel << "\". Will use TRACE as default!";
      Orthanc::Logging::EnableInfoLevel(true);
      Orthanc::Logging::EnableTraceLevel(true);
    }
  }
}