comparison Core/Logging.cpp @ 4010:f0ee3f1db775

removed unused Logging::SetErrorWarnInfoTraceLoggingFunctions()
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 08 Jun 2020 15:54:30 +0200
parents 55710d73780f
children 27628b0f6ada
comparison
equal deleted inserted replaced
4009:16978ee28588 4010:f0ee3f1db775
162 { 162 {
163 static bool globalVerbose_ = false; 163 static bool globalVerbose_ = false;
164 static bool globalTrace_ = false; 164 static bool globalTrace_ = false;
165 165
166 #ifdef __EMSCRIPTEN__ 166 #ifdef __EMSCRIPTEN__
167 static void defaultErrorLogFunc(const char* msg) 167 static void ErrorLogFunc(const char* msg)
168 { 168 {
169 emscripten_console_error(msg); 169 emscripten_console_error(msg);
170 } 170 }
171 171
172 static void defaultWarningLogFunc(const char* msg) 172 static void WarningLogFunc(const char* msg)
173 { 173 {
174 emscripten_console_warn(msg); 174 emscripten_console_warn(msg);
175 } 175 }
176 176
177 static void defaultInfoLogFunc(const char* msg) 177 static void InfoLogFunc(const char* msg)
178 { 178 {
179 emscripten_console_log(msg); 179 emscripten_console_log(msg);
180 } 180 }
181 181
182 static void defaultTraceLogFunc(const char* msg) 182 static void TraceLogFunc(const char* msg)
183 { 183 {
184 emscripten_console_log(msg); 184 emscripten_console_log(msg);
185 } 185 }
186 #else 186 #else
187 // __EMSCRIPTEN__ not #defined 187 // __EMSCRIPTEN__ not #defined
188 static void defaultErrorLogFunc(const char* msg) 188 static void ErrorLogFunc(const char* msg)
189 { 189 {
190 fprintf(stderr, "E: %s\n", msg); 190 fprintf(stderr, "E: %s\n", msg);
191 } 191 }
192 192
193 static void defaultWarningLogFunc(const char*) 193 static void WarningLogFunc(const char*)
194 { 194 {
195 fprintf(stdout, "W: %s\n", msg); 195 fprintf(stdout, "W: %s\n", msg);
196 } 196 }
197 197
198 static void defaultInfoLogFunc(const char*) 198 static void InfoLogFunc(const char*)
199 { 199 {
200 fprintf(stdout, "I: %s\n", msg); 200 fprintf(stdout, "I: %s\n", msg);
201 } 201 }
202 202
203 static void defaultTraceLogFunc(const char*) 203 static void TraceLogFunc(const char*)
204 { 204 {
205 fprintf(stdout, "T: %s\n", msg); 205 fprintf(stdout, "T: %s\n", msg);
206 } 206 }
207 #endif 207 #endif
208 // __EMSCRIPTEN__ 208 // __EMSCRIPTEN__
209
210 static LoggingFunction globalErrorLogFunc = defaultErrorLogFunc;
211 static LoggingFunction globalWarningLogFunc = defaultWarningLogFunc;
212 static LoggingFunction globalInfoLogFunc = defaultInfoLogFunc;
213 static LoggingFunction globalTraceLogFunc = defaultTraceLogFunc;
214
215 void SetErrorWarnInfoTraceLoggingFunctions(LoggingFunction errorLogFunc,
216 LoggingFunction warningLogfunc,
217 LoggingFunction infoLogFunc,
218 LoggingFunction traceLogFunc)
219 {
220 globalErrorLogFunc = errorLogFunc;
221 globalWarningLogFunc = warningLogfunc;
222 globalInfoLogFunc = infoLogFunc;
223 globalTraceLogFunc = traceLogFunc;
224 }
225 209
226 InternalLogger::InternalLogger(LogLevel level, 210 InternalLogger::InternalLogger(LogLevel level,
227 const char* file /* ignored */, 211 const char* file /* ignored */,
228 int line /* ignored */) : 212 int line /* ignored */) :
229 level_(level) 213 level_(level)
737 721
738 722
739 InternalLogger::InternalLogger(LogLevel level, 723 InternalLogger::InternalLogger(LogLevel level,
740 const char* file, 724 const char* file,
741 int line) : 725 int line) :
742 lock_(loggingMutex_), 726 lock_(loggingMutex_, boost::defer_lock_t()),
743 stream_(&null_) // By default, logging to "/dev/null" is simulated 727 stream_(&null_) // By default, logging to "/dev/null" is simulated
744 { 728 {
729 lock_.lock();
730
745 if (loggingContext_.get() == NULL) 731 if (loggingContext_.get() == NULL)
746 { 732 {
747 fprintf(stderr, "ERROR: Trying to log a message after the finalization of the logging engine\n"); 733 fprintf(stderr, "ERROR: Trying to log a message after the finalization of the logging engine\n");
748 return; 734 return;
749 } 735 }