comparison Core/Logging.cpp @ 2014:e39a2657f1c6

Dropped support of Google Log
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 13 Jun 2016 13:39:10 +0200
parents b1291df2f780
children bcc575732aef
comparison
equal deleted inserted replaced
2013:f6e68c0c2737 2014:e39a2657f1c6
59 { 59 {
60 } 60 }
61 } 61 }
62 } 62 }
63 63
64 #elif ORTHANC_ENABLE_GOOGLE_LOG == 1 64 #else
65 65
66 /********************************************************* 66 /*********************************************************
67 * Wrapper around Google Log 67 * Internal logger of Orthanc, that mimics some
68 *********************************************************/ 68 * behavior from Google Log.
69
70 namespace Orthanc
71 {
72 namespace Logging
73 {
74 void Initialize()
75 {
76 // Initialize Google's logging library.
77 FLAGS_logtostderr = true;
78 FLAGS_minloglevel = 1; // Do not print LOG(INFO) by default
79 FLAGS_v = 0; // Do not print trace-level VLOG(1) by default
80
81 google::InitGoogleLogging("Orthanc");
82 }
83
84 void Finalize()
85 {
86 google::ShutdownGoogleLogging();
87 }
88
89 void EnableInfoLevel(bool enabled)
90 {
91 FLAGS_minloglevel = (enabled ? 0 : 1);
92 }
93
94 void EnableTraceLevel(bool enabled)
95 {
96 if (enabled)
97 {
98 FLAGS_minloglevel = 0;
99 FLAGS_v = 1;
100 }
101 else
102 {
103 FLAGS_v = 0;
104 }
105 }
106
107 void SetTargetFolder(const std::string& path)
108 {
109 FLAGS_logtostderr = false;
110 FLAGS_log_dir = path;
111 }
112 }
113 }
114
115 #else
116
117 /*********************************************************
118 * Use internal logger, not Google Log
119 *********************************************************/ 69 *********************************************************/
120 70
121 #include "OrthancException.h" 71 #include "OrthancException.h"
122 #include "Enumerations.h" 72 #include "Enumerations.h"
123 #include "Toolbox.h" 73 #include "Toolbox.h"