Make the logging system static

No initialization is needed anymore and we can use the logging functions
safely at any point of the code (threading is not handled though, so you
might get multiplexed messages if you log from two threads
simultaneously).
This commit is contained in:
Thiago Marcos P. Santos
2015-03-09 16:15:18 +02:00
committed by Thiago Marcos P. Santos
parent 2948e7d121
commit 51bc265db3
13 changed files with 33 additions and 121 deletions

View File

@@ -4,13 +4,11 @@
namespace mbgl {
std::unique_ptr<LogBackend> Log::Backend;
void LogBackend::record(EventSeverity severity, Event event, const std::string &msg) {
void Log::record(EventSeverity severity, Event event, const std::string &msg) {
record(severity, event, -1, msg);
}
void LogBackend::record(EventSeverity severity, Event event, const char* format, ...) {
void Log::record(EventSeverity severity, Event event, const char* format, ...) {
va_list args;
va_start(args, format);
char msg[4096];
@@ -20,8 +18,12 @@ void LogBackend::record(EventSeverity severity, Event event, const char* format,
record(severity, event, -1, msg);
}
void LogBackend::record(EventSeverity severity, Event event, int64_t code) {
void Log::record(EventSeverity severity, Event event, int64_t code) {
record(severity, event, code, std::string());
}
void Log::record(EventSeverity severity, Event event, int64_t code, const std::string &msg) {
platformRecord(severity, event, code, msg);
}
}