view Samples/Common/SampleHelpers.h @ 1392:ffdb82850e98

Sdl run loop in /Common (might revert if need to customize) Segregation ongoing between sdl wasm Both samples ok SDL msvc v141 x64
author Benjamin Golinvaux <bgo@osimis.io>
date Tue, 28 Apr 2020 13:52:21 +0200
parents dfb48f0794b1
children 15173a383a00
line wrap: on
line source

#pragma once

#include <Core/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);
    }
  }
}