comparison Samples/CommonHelpers.h @ 1382:9d138883be66

Proper command-line parameter management for SDL sample
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 22 Apr 2020 19:55:34 +0200
parents
children
comparison
equal deleted inserted replaced
1381:f4a06ad1580b 1382:9d138883be66
1 #pragma once
2
3 #include <string>
4 #include <iostream>
5
6 #include <Core/Logging.h>
7
8 namespace OrthancStoneHelpers
9 {
10 inline void SetLogLevel(std::string logLevel)
11 {
12 boost::to_lower(logLevel);
13 if (logLevel == "warning")
14 {
15 Orthanc::Logging::EnableInfoLevel(false);
16 Orthanc::Logging::EnableTraceLevel(false);
17 }
18 else if (logLevel == "info")
19 {
20 Orthanc::Logging::EnableInfoLevel(true);
21 Orthanc::Logging::EnableTraceLevel(false);
22 }
23 else if (logLevel == "trace")
24 {
25 Orthanc::Logging::EnableInfoLevel(true);
26 Orthanc::Logging::EnableTraceLevel(true);
27 }
28 else
29 {
30 std::cerr << "Unknown log level \"" << logLevel << "\". Will use TRACE as default!";
31 Orthanc::Logging::EnableInfoLevel(true);
32 Orthanc::Logging::EnableTraceLevel(true);
33 }
34 }
35 }