To make it easier to debug, add the Environment ID and the Thread name
to the log messages. For instance log messages from the TileParser will look like:
[WARNING] {0}{TileWorker_15/18653/9486}[ParseTile]: some relevant warning message
| | | |
| | | +-> Component
| | +--------------------> Thread name
| +----------------------------------> Environment ID
+------------------------------------------> Severity level
Log messages that are not inside an Environment::Scope will work
normally and will look like:
[WARNING] [JNI]: some relevant warning message
Fixes #882.
14 lines
362 B
Plaintext
14 lines
362 B
Plaintext
#include <mbgl/platform/log.hpp>
|
|
|
|
#import <Foundation/Foundation.h>
|
|
|
|
namespace mbgl {
|
|
|
|
void Log::platformRecord(EventSeverity severity, const std::string &msg) {
|
|
NSString *message =
|
|
[[NSString alloc] initWithBytes:msg.data() length:msg.size() encoding:NSUTF8StringEncoding];
|
|
NSLog(@"[%s] %@", EventSeverityClass(severity).c_str(), message);
|
|
}
|
|
|
|
}
|