From 2e5897c0f49120c72b7431b3af7d41bef3414719 Mon Sep 17 00:00:00 2001 From: m-stephen Date: Thu, 25 Jul 2019 15:39:01 +0800 Subject: [ios, macos]MGLLoggingConfiguration can filter logs from core (#15120) * [ios, macos] update proj config * [ios, macos] implement the logging logic * [ios, macos] update comments * [ios, macos] update mac os config * [ios, macos] re-generate sdk files * [ios, macos] re-generate sdk files json * [ios, macos]re-generate json files * [ios, macos] re-generate ios json files * [ios] change conditions to bit mask * [ios, macos]send messages to platform * [ios, macos] add changelogs * [ios, macos] revert `logging_nslog` * [ios, macos] add event name and code into log msg * [ios, macos] update changlog * [ios, macos] fix a nit * [ios, macos]Fix nits. --- platform/darwin/filesource-files.json | 2 +- platform/darwin/src/MGLLoggingConfiguration.h | 29 ++-- platform/darwin/src/MGLLoggingConfiguration.m | 121 ---------------- platform/darwin/src/MGLLoggingConfiguration.mm | 161 +++++++++++++++++++++ .../darwin/src/MGLLoggingConfiguration_Private.h | 8 +- platform/darwin/src/logging_nslog.mm | 12 +- platform/ios/CHANGELOG.md | 4 + platform/ios/ios.xcodeproj/project.pbxproj | 12 +- platform/ios/sdk-files.json | 2 +- platform/macos/CHANGELOG.md | 1 + platform/macos/macos.xcodeproj/project.pbxproj | 8 +- platform/macos/sdk-files.json | 2 +- 12 files changed, 207 insertions(+), 155 deletions(-) delete mode 100644 platform/darwin/src/MGLLoggingConfiguration.m create mode 100644 platform/darwin/src/MGLLoggingConfiguration.mm diff --git a/platform/darwin/filesource-files.json b/platform/darwin/filesource-files.json index b2e6fbc9b4..62043a0dcd 100644 --- a/platform/darwin/filesource-files.json +++ b/platform/darwin/filesource-files.json @@ -1,7 +1,7 @@ { "//": "This file can be edited manually and is the canonical source.", "sources": [ - "platform/darwin/src/MGLLoggingConfiguration.m", + "platform/darwin/src/MGLLoggingConfiguration.mm", "platform/darwin/src/MGLNetworkConfiguration.m", "platform/darwin/src/http_file_source.mm", "platform/default/src/mbgl/storage/file_source.cpp", diff --git a/platform/darwin/src/MGLLoggingConfiguration.h b/platform/darwin/src/MGLLoggingConfiguration.h index d79336df4c..2445078584 100644 --- a/platform/darwin/src/MGLLoggingConfiguration.h +++ b/platform/darwin/src/MGLLoggingConfiguration.h @@ -16,33 +16,38 @@ NS_ASSUME_NONNULL_BEGIN */ typedef NS_ENUM(NSInteger, MGLLoggingLevel) { /** - None-level messages are ignored. + None-level won't print any messages. */ MGLLoggingLevelNone = 0, + /** + Fault-level messages contain system-level error information. + */ + MGLLoggingLevelFault, + /** + Error-level messages contain information that is intended to aid in process-level + errors. + */ + MGLLoggingLevelError, + /** + Warning-level messages contain warning information for potential risks. + */ + MGLLoggingLevelWarning, /** Info-level messages contain information that may be helpful for flow tracing but is not essential. */ MGLLoggingLevelInfo, -#if MGL_LOGGING_ENABLE_DEBUG /** Debug-level messages contain information that may be helpful for troubleshooting specific problems. */ +#if MGL_LOGGING_ENABLE_DEBUG MGLLoggingLevelDebug, #endif /** - Error-level messages contain information that is intended to aid in process-level - errors. - */ - MGLLoggingLevelError, - /** - Fault-level messages contain system-level error information. - */ - MGLLoggingLevelFault, - /** - :nodoc: Any new logging level should be included in the default logging implementation. + Verbose-level will print all messages. */ + MGLLoggingLevelVerbose, }; /** diff --git a/platform/darwin/src/MGLLoggingConfiguration.m b/platform/darwin/src/MGLLoggingConfiguration.m deleted file mode 100644 index 4dfe3f7901..0000000000 --- a/platform/darwin/src/MGLLoggingConfiguration.m +++ /dev/null @@ -1,121 +0,0 @@ -#import "MGLLoggingConfiguration_Private.h" - -#ifndef MGL_LOGGING_DISABLED -#if __has_builtin(__builtin_os_log_format) -#import -#endif - -@implementation MGLLoggingConfiguration - -+ (instancetype)sharedConfiguration -{ - static dispatch_once_t once; - static id sharedConfiguration; - dispatch_once(&once, ^{ - sharedConfiguration = [[self alloc] init]; - ((MGLLoggingConfiguration *)sharedConfiguration).handler = nil; - }); - return sharedConfiguration; -} - -- (void)setHandler:(void (^)(MGLLoggingLevel, NSString *, NSUInteger, NSString *))handler { - - if (!handler) { - _handler = [self defaultBlockHandler]; - } else { - _handler = handler; - } -} - -- (void)logCallingFunction:(const char *)callingFunction functionLine:(NSUInteger)functionLine messageType:(MGLLoggingLevel)type format:(id)messageFormat, ... -{ - va_list formatList; - va_start(formatList, messageFormat); - NSString *formattedMessage = [[NSString alloc] initWithFormat:messageFormat arguments:formatList]; - va_end(formatList); - - _handler(type, @(callingFunction), functionLine, formattedMessage); - -} - -- (MGLLoggingBlockHandler)defaultBlockHandler { - MGLLoggingBlockHandler mapboxHandler = ^(MGLLoggingLevel level, NSString *fileName, NSUInteger line, NSString *message) { - - if (@available(iOS 10.0, macOS 10.12.0, *)) { - static dispatch_once_t once; - static os_log_t info_log; -#if MGL_LOGGING_ENABLE_DEBUG - static os_log_t debug_log; -#endif - static os_log_t error_log; - static os_log_t fault_log; - static os_log_type_t log_types[] = { OS_LOG_TYPE_DEFAULT, - OS_LOG_TYPE_INFO, -#if MGL_LOGGING_ENABLE_DEBUG - OS_LOG_TYPE_DEBUG, -#endif - OS_LOG_TYPE_ERROR, - OS_LOG_TYPE_FAULT }; - dispatch_once(&once, ^ { - info_log = os_log_create("com.mapbox.Mapbox", "INFO"); -#if MGL_LOGGING_ENABLE_DEBUG - debug_log = os_log_create("com.mapbox.Mapbox", "DEBUG"); -#endif - error_log = os_log_create("com.mapbox.Mapbox", "ERROR"); - fault_log = os_log_create("com.mapbox.Mapbox", "FAULT"); - }); - - os_log_t mapbox_log; - switch (level) { - case MGLLoggingLevelInfo: - mapbox_log = info_log; - break; -#if MGL_LOGGING_ENABLE_DEBUG - case MGLLoggingLevelDebug: - mapbox_log = debug_log; - break; -#endif - case MGLLoggingLevelError: - mapbox_log = error_log; - break; - case MGLLoggingLevelFault: - mapbox_log = fault_log; - break; - case MGLLoggingLevelNone: - default: - break; - } - - os_log_type_t logType = log_types[level]; - os_log_with_type(mapbox_log, logType, "%@ - %lu: %@", fileName, (unsigned long)line, message); - } else { - NSString *category; - switch (level) { - case MGLLoggingLevelInfo: - category = @"INFO"; - break; -#if MGL_LOGGING_ENABLE_DEBUG - case MGLLoggingLevelDebug: - category = @"DEBUG"; - break; -#endif - case MGLLoggingLevelError: - category = @"ERROR"; - break; - case MGLLoggingLevelFault: - category = @"FAULT"; - break; - case MGLLoggingLevelNone: - default: - break; - } - - NSLog(@"[%@] %@ - %lu: %@", category, fileName, (unsigned long)line, message); - } - }; - - return mapboxHandler; -} - -@end -#endif diff --git a/platform/darwin/src/MGLLoggingConfiguration.mm b/platform/darwin/src/MGLLoggingConfiguration.mm new file mode 100644 index 0000000000..75d2439365 --- /dev/null +++ b/platform/darwin/src/MGLLoggingConfiguration.mm @@ -0,0 +1,161 @@ +#include +#include + +#import "MGLLoggingConfiguration_Private.h" + +#ifndef MGL_LOGGING_DISABLED +#if __has_builtin(__builtin_os_log_format) +#import +#endif + +namespace mbgl { + +class MGLCoreLoggingObserver : public Log :: Observer { +public: + //Return true not print messages at core level, and filter at platform level. + bool onRecord(EventSeverity severity, Event event, int64_t code, const std::string& msg) override{ + + NSString *message = [NSString stringWithFormat:@"[event]:%s [code]:%lld [message]:%@", Enum::toString(event), code, [NSString stringWithCString:msg.c_str() encoding:NSUTF8StringEncoding]]; + switch (severity) { + case EventSeverity::Debug: + MGLLogDebug(message); + break; + case EventSeverity::Info: + MGLLogInfo(message); + break; + case EventSeverity::Warning: + MGLLogWarning(message); + break; + case EventSeverity::Error: + MGLLogError(message); + break; + } + return true; + } +}; +} + +@implementation MGLLoggingConfiguration +{ + std::unique_ptr _coreLoggingObserver; +} + ++ (instancetype)sharedConfiguration { + static dispatch_once_t once; + static id sharedConfiguration; + dispatch_once(&once, ^{ + sharedConfiguration = [[self alloc] init]; + ((MGLLoggingConfiguration *)sharedConfiguration).handler = nil; + }); + return sharedConfiguration; +} + +- (id)init{ + if(self = [super init]){ + mbgl::Log::setObserver(std::make_unique()); + } + return self; +} + +- (void)setHandler:(void (^)(MGLLoggingLevel, NSString *, NSUInteger, NSString *))handler { + + if (!handler) { + _handler = [self defaultBlockHandler]; + } else { + _handler = handler; + } +} + +- (void)logCallingFunction:(const char *)callingFunction functionLine:(NSUInteger)functionLine messageType:(MGLLoggingLevel)type format:(id)messageFormat, ... { + va_list formatList; + va_start(formatList, messageFormat); + NSString *formattedMessage = [[NSString alloc] initWithFormat:messageFormat arguments:formatList]; + va_end(formatList); + + _handler(type, @(callingFunction), functionLine, formattedMessage); + +} + +- (MGLLoggingBlockHandler)defaultBlockHandler { + MGLLoggingBlockHandler mapboxHandler = ^(MGLLoggingLevel level, NSString *fileName, NSUInteger line, NSString *message) { + + if (@available(iOS 10.0, macOS 10.12.0, *)) { + static dispatch_once_t once; + static os_log_t info_log; +#if MGL_LOGGING_ENABLE_DEBUG + static os_log_t debug_log; +#endif + static os_log_t error_log; + static os_log_t fault_log; + static os_log_type_t log_types[] = { OS_LOG_TYPE_DEFAULT, + OS_LOG_TYPE_INFO, +#if MGL_LOGGING_ENABLE_DEBUG + OS_LOG_TYPE_DEBUG, +#endif + OS_LOG_TYPE_ERROR, + OS_LOG_TYPE_FAULT }; + dispatch_once(&once, ^ { + info_log = os_log_create("com.mapbox.Mapbox", "INFO"); +#if MGL_LOGGING_ENABLE_DEBUG + debug_log = os_log_create("com.mapbox.Mapbox", "DEBUG"); +#endif + error_log = os_log_create("com.mapbox.Mapbox", "ERROR"); + fault_log = os_log_create("com.mapbox.Mapbox", "FAULT"); + }); + + os_log_t mapbox_log; + switch (level) { + case MGLLoggingLevelInfo: + case MGLLoggingLevelWarning: + mapbox_log = info_log; + break; +#if MGL_LOGGING_ENABLE_DEBUG + case MGLLoggingLevelDebug: + mapbox_log = debug_log; + break; +#endif + case MGLLoggingLevelError: + mapbox_log = error_log; + break; + case MGLLoggingLevelFault: + mapbox_log = fault_log; + break; + case MGLLoggingLevelNone: + default: + break; + } + + os_log_type_t logType = log_types[level]; + os_log_with_type(mapbox_log, logType, "%@ - %lu: %@", fileName, (unsigned long)line, message); + } else { + NSString *category; + switch (level) { + case MGLLoggingLevelInfo: + case MGLLoggingLevelWarning: + category = @"INFO"; + break; +#if MGL_LOGGING_ENABLE_DEBUG + case MGLLoggingLevelDebug: + category = @"DEBUG"; + break; +#endif + case MGLLoggingLevelError: + category = @"ERROR"; + break; + case MGLLoggingLevelFault: + category = @"FAULT"; + break; + case MGLLoggingLevelNone: + default: + break; + } + + NSLog(@"[%@] %@ - %lu: %@", category, fileName, (unsigned long)line, message); + } + }; + + return mapboxHandler; +} + +@end +#endif diff --git a/platform/darwin/src/MGLLoggingConfiguration_Private.h b/platform/darwin/src/MGLLoggingConfiguration_Private.h index 3acc0291c0..40b4df440d 100644 --- a/platform/darwin/src/MGLLoggingConfiguration_Private.h +++ b/platform/darwin/src/MGLLoggingConfiguration_Private.h @@ -14,6 +14,7 @@ NS_INLINE NSString *MGLStringFromNSEdgeInsets(NSEdgeInsets insets) { #define MGLLogInfo(...) #define MGLLogDebug(...) +#define MGLLogWarning(...) #define MGLLogError(...) #define MGLLogFault(...) @@ -25,9 +26,10 @@ NS_INLINE NSString *MGLStringFromNSEdgeInsets(NSEdgeInsets insets) { #define MGLLogDebug(...) #endif -#define MGLLogInfo(message, ...) MGLLogWithType(MGLLoggingLevelInfo, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__) -#define MGLLogError(message, ...) MGLLogWithType(MGLLoggingLevelError, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__) -#define MGLLogFault(message, ...) MGLLogWithType(MGLLoggingLevelFault, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__) +#define MGLLogInfo(message, ...) MGLLogWithType(MGLLoggingLevelInfo, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__) +#define MGLLogWarning(message, ...) MGLLogWithType(MGLLoggingLevelWarning, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__) +#define MGLLogError(message, ...) MGLLogWithType(MGLLoggingLevelError, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__) +#define MGLLogFault(message, ...) MGLLogWithType(MGLLoggingLevelFault, __PRETTY_FUNCTION__, __LINE__, message, ##__VA_ARGS__) #endif diff --git a/platform/darwin/src/logging_nslog.mm b/platform/darwin/src/logging_nslog.mm index dd428f56b1..ac3c939bb5 100644 --- a/platform/darwin/src/logging_nslog.mm +++ b/platform/darwin/src/logging_nslog.mm @@ -4,11 +4,11 @@ #import namespace mbgl { - -void Log::platformRecord(EventSeverity severity, const std::string &msg) { - NSString *message = + + void Log::platformRecord(EventSeverity severity, const std::string &msg) { + NSString *message = [[NSString alloc] initWithBytes:msg.data() length:msg.size() encoding:NSUTF8StringEncoding]; - NSLog(@"[%s] %@", Enum::toString(severity), message); -} - + NSLog(@"[%s] %@", Enum::toString(severity), message); + } + } diff --git a/platform/ios/CHANGELOG.md b/platform/ios/CHANGELOG.md index 9fe972c18c..0a99a9d4d3 100644 --- a/platform/ios/CHANGELOG.md +++ b/platform/ios/CHANGELOG.md @@ -8,6 +8,10 @@ Mapbox welcomes participation and contributions from everyone. Please read [CONT * Fixed flickering on style change for the same tile set. ([#15127](https://github.com/mapbox/mapbox-gl-native/pull/15127)) +### Other changes + +* `MGLLoggingLevel` has been updated for better matching core log levels. Now can use `[MGLLoggingConfiguration sharedConfiguration].loggingLevel` to filter logs from core . [#15120](https://github.com/mapbox/mapbox-gl-native/pull/15120) + ## 5.2.0 - July 24, 2019 ### Networking diff --git a/platform/ios/ios.xcodeproj/project.pbxproj b/platform/ios/ios.xcodeproj/project.pbxproj index 5f0d29a5e7..7b74292c62 100644 --- a/platform/ios/ios.xcodeproj/project.pbxproj +++ b/platform/ios/ios.xcodeproj/project.pbxproj @@ -43,8 +43,6 @@ 1F2B94C1221636D900210640 /* MGLNetworkConfiguration_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F2B94BF221636D800210640 /* MGLNetworkConfiguration_Private.h */; }; 1F6A82A221360F9D00BA5B41 /* MGLLoggingConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F6A82A021360F9C00BA5B41 /* MGLLoggingConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F6A82A321360F9D00BA5B41 /* MGLLoggingConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F6A82A021360F9C00BA5B41 /* MGLLoggingConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 1F6A82A421360F9D00BA5B41 /* MGLLoggingConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F6A82A121360F9C00BA5B41 /* MGLLoggingConfiguration.m */; }; - 1F6A82A521360F9D00BA5B41 /* MGLLoggingConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F6A82A121360F9C00BA5B41 /* MGLLoggingConfiguration.m */; }; 1F6A82A82138871900BA5B41 /* MGLLoggingConfiguration_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F6A82A62138871900BA5B41 /* MGLLoggingConfiguration_Private.h */; }; 1F6A82A92138871900BA5B41 /* MGLLoggingConfiguration_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F6A82A62138871900BA5B41 /* MGLLoggingConfiguration_Private.h */; }; 1F7454921ECBB42C00021D39 /* MGLLight.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F0666891EC64F8E001C16D7 /* MGLLight.mm */; }; @@ -525,6 +523,8 @@ CABE5DAD2072FAB40003AF3C /* Mapbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DA8847D21CBAF91600AB86E3 /* Mapbox.framework */; }; CAD9D0AA22A86D6F001B25EE /* MGLResourceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CAD9D0A922A86D6F001B25EE /* MGLResourceTests.mm */; }; CAE7AD5520F46EF5003B6782 /* MGLMapSnapshotterSwiftTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CAE7AD5420F46EF5003B6782 /* MGLMapSnapshotterSwiftTests.swift */; }; + CF75A91522D85E860058A5C4 /* MGLLoggingConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = CF75A91422D85E860058A5C4 /* MGLLoggingConfiguration.mm */; }; + CF75A91622D85E860058A5C4 /* MGLLoggingConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = CF75A91422D85E860058A5C4 /* MGLLoggingConfiguration.mm */; }; DA00FC8E1D5EEB0D009AABC8 /* MGLAttributionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = DA00FC8C1D5EEB0D009AABC8 /* MGLAttributionInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA00FC8F1D5EEB0D009AABC8 /* MGLAttributionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = DA00FC8C1D5EEB0D009AABC8 /* MGLAttributionInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA00FC901D5EEB0D009AABC8 /* MGLAttributionInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA00FC8D1D5EEB0D009AABC8 /* MGLAttributionInfo.mm */; }; @@ -899,7 +899,6 @@ 1F26B6C220E1A351007BCC21 /* simple_route.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; path = simple_route.json; sourceTree = ""; }; 1F2B94BF221636D800210640 /* MGLNetworkConfiguration_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLNetworkConfiguration_Private.h; sourceTree = ""; }; 1F6A82A021360F9C00BA5B41 /* MGLLoggingConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLLoggingConfiguration.h; sourceTree = ""; }; - 1F6A82A121360F9C00BA5B41 /* MGLLoggingConfiguration.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MGLLoggingConfiguration.m; sourceTree = ""; }; 1F6A82A62138871900BA5B41 /* MGLLoggingConfiguration_Private.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MGLLoggingConfiguration_Private.h; sourceTree = ""; }; 1F7454941ECD450D00021D39 /* MGLLight_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLLight_Private.h; sourceTree = ""; }; 1F7454A61ED08AB400021D39 /* MGLLightTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLLightTest.mm; path = ../../darwin/test/MGLLightTest.mm; sourceTree = ""; }; @@ -1207,6 +1206,7 @@ CAD9D0A922A86D6F001B25EE /* MGLResourceTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLResourceTests.mm; path = ../../darwin/test/MGLResourceTests.mm; sourceTree = ""; }; CAE7AD5320F46EF5003B6782 /* integration-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "integration-Bridging-Header.h"; sourceTree = ""; }; CAE7AD5420F46EF5003B6782 /* MGLMapSnapshotterSwiftTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MGLMapSnapshotterSwiftTests.swift; sourceTree = ""; }; + CF75A91422D85E860058A5C4 /* MGLLoggingConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLLoggingConfiguration.mm; sourceTree = ""; }; DA00FC8C1D5EEB0D009AABC8 /* MGLAttributionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAttributionInfo.h; sourceTree = ""; }; DA00FC8D1D5EEB0D009AABC8 /* MGLAttributionInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLAttributionInfo.mm; sourceTree = ""; }; DA0CD58F1CF56F6A00A5F5A5 /* MGLFeatureTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLFeatureTests.mm; path = ../../darwin/test/MGLFeatureTests.mm; sourceTree = ""; }; @@ -2141,7 +2141,7 @@ 1FCAE2A620B88B3800C577DD /* MGLLocationManager_Private.h */, 1FCAE2A120B872A400C577DD /* MGLLocationManager.m */, 1F6A82A021360F9C00BA5B41 /* MGLLoggingConfiguration.h */, - 1F6A82A121360F9C00BA5B41 /* MGLLoggingConfiguration.m */, + CF75A91422D85E860058A5C4 /* MGLLoggingConfiguration.mm */, 1F6A82A62138871900BA5B41 /* MGLLoggingConfiguration_Private.h */, ); name = Foundation; @@ -3358,6 +3358,7 @@ DAF25719201901E200367EF5 /* MGLHillshadeStyleLayer.mm in Sources */, 9C6E281922A97FDC0056B7BE /* UIKit+MMEMobileEvents.m in Sources */, 35136D451D42275100C20EFD /* MGLSymbolStyleLayer.mm in Sources */, + CF75A91522D85E860058A5C4 /* MGLLoggingConfiguration.mm in Sources */, 35599DED1D46F14E0048254D /* MGLStyleValue.mm in Sources */, DA8848211CBAFA6200AB86E3 /* MGLOfflinePack.mm in Sources */, 0778DD441F67556C00A73B34 /* MGLComputedShapeSource.mm in Sources */, @@ -3393,7 +3394,6 @@ DA88482B1CBAFA6200AB86E3 /* MGLTypes.m in Sources */, FA68F14D1E9D656600F9F6C2 /* MGLFillExtrusionStyleLayer.mm in Sources */, 404C26E41D89B877000AA13D /* MGLTileSource.mm in Sources */, - 1F6A82A421360F9D00BA5B41 /* MGLLoggingConfiguration.m in Sources */, 355AE0011E9281DA00F3939D /* MGLScaleBar.mm in Sources */, DA88481D1CBAFA6200AB86E3 /* MGLMapCamera.mm in Sources */, DACA86282019218600E9693A /* MGLRasterDEMSource.mm in Sources */, @@ -3485,6 +3485,7 @@ 35599DEE1D46F14E0048254D /* MGLStyleValue.mm in Sources */, DAA4E42B1CBB730400178DFB /* NSString+MGLAdditions.m in Sources */, DAA4E4261CBB730400178DFB /* MGLStyle.mm in Sources */, + CF75A91622D85E860058A5C4 /* MGLLoggingConfiguration.mm in Sources */, DAA32CC31E4C6B65006F8D24 /* MGLDistanceFormatter.m in Sources */, DAA4E41D1CBB730400178DFB /* MGLGeometry.mm in Sources */, 40834BFB1FE05E1800C1BD0D /* MMEAPIClient.m in Sources */, @@ -3521,7 +3522,6 @@ 355AE0021E9281DA00F3939D /* MGLScaleBar.mm in Sources */, 4018B1C81CDC287F00F666AF /* MGLAnnotationView.mm in Sources */, 07D8C6FB1F67560100381808 /* MGLComputedShapeSource.mm in Sources */, - 1F6A82A521360F9D00BA5B41 /* MGLLoggingConfiguration.m in Sources */, DAA4E4341CBB730400178DFB /* MGLFaux3DUserLocationAnnotationView.m in Sources */, DACA86292019218600E9693A /* MGLRasterDEMSource.mm in Sources */, 35B82BFB1D6C5F8400B1B721 /* NSPredicate+MGLAdditions.mm in Sources */, diff --git a/platform/ios/sdk-files.json b/platform/ios/sdk-files.json index 5ce2423ba9..4a28116550 100644 --- a/platform/ios/sdk-files.json +++ b/platform/ios/sdk-files.json @@ -58,6 +58,7 @@ "platform/darwin/src/MGLHillshadeStyleLayer.mm", "platform/ios/vendor/mapbox-events-ios/MapboxMobileEvents/Categories/UIKit+MMEMobileEvents.m", "platform/darwin/src/MGLSymbolStyleLayer.mm", + "platform/darwin/src/MGLLoggingConfiguration.mm", "platform/darwin/src/MGLStyleValue.mm", "platform/darwin/src/MGLOfflinePack.mm", "platform/darwin/src/MGLComputedShapeSource.mm", @@ -93,7 +94,6 @@ "platform/darwin/src/MGLTypes.m", "platform/darwin/src/MGLFillExtrusionStyleLayer.mm", "platform/darwin/src/MGLTileSource.mm", - "platform/darwin/src/MGLLoggingConfiguration.m", "platform/ios/src/MGLScaleBar.mm", "platform/darwin/src/MGLMapCamera.mm", "platform/darwin/src/MGLRasterDEMSource.mm", diff --git a/platform/macos/CHANGELOG.md b/platform/macos/CHANGELOG.md index 88fa37052b..68b7e243da 100644 --- a/platform/macos/CHANGELOG.md +++ b/platform/macos/CHANGELOG.md @@ -8,6 +8,7 @@ * The `MGLIdeographicFontFamilyName` Info.plist key now also accepts an array of font family names, to customize font fallback behavior. It can also be set to a Boolean value of `NO` to force the SDK to typeset CJK characters in a remote font specified by `MGLSymbolStyleLayer.textFontNames`. ([#14862](https://github.com/mapbox/mapbox-gl-native/pull/14862)) * Performance improvements for queryRenderedFeatures API and optimization that allocates containers based on a number of rendered layers. ([#14930](https://github.com/mapbox/mapbox-gl-native/pull/14930)) * Fixed rendering layers after fill-extrusion regression caused by optimization of fill-extrusion rendering. ([#15065](https://github.com/mapbox/mapbox-gl-native/pull/15065)) +* `MGLLoggingLevel` has been updated for better matching core log levels. Now can use `[MGLLoggingConfiguration sharedConfiguration].loggingLevel` to filter logs from core . [#15120](https://github.com/mapbox/mapbox-gl-native/pull/15120) ### Styles and rendering diff --git a/platform/macos/macos.xcodeproj/project.pbxproj b/platform/macos/macos.xcodeproj/project.pbxproj index 79540e1fef..45e5a6d653 100644 --- a/platform/macos/macos.xcodeproj/project.pbxproj +++ b/platform/macos/macos.xcodeproj/project.pbxproj @@ -25,7 +25,6 @@ 1F7454AB1ED1DDBD00021D39 /* MGLLightTest.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F7454AA1ED1DDBD00021D39 /* MGLLightTest.mm */; }; 1F8A59FA21653483004DFE75 /* sideload_sat.db in Resources */ = {isa = PBXBuildFile; fileRef = 1F8A59F921653483004DFE75 /* sideload_sat.db */; }; 1F8A5A04216D4696004DFE75 /* MGLLoggingConfiguration_Private.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F8A5A01216D4695004DFE75 /* MGLLoggingConfiguration_Private.h */; }; - 1F8A5A05216D4696004DFE75 /* MGLLoggingConfiguration.m in Sources */ = {isa = PBXBuildFile; fileRef = 1F8A5A02216D4695004DFE75 /* MGLLoggingConfiguration.m */; }; 1F8A5A06216D4696004DFE75 /* MGLLoggingConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 1F8A5A03216D4696004DFE75 /* MGLLoggingConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; }; 1F95931B1E6DE2B600D5B294 /* MGLNSDateAdditionsTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1F95931A1E6DE2B600D5B294 /* MGLNSDateAdditionsTests.mm */; }; 1F9EF4061FBA1B0E0063FBB0 /* mapbox_helmet.pdf in Resources */ = {isa = PBXBuildFile; fileRef = 1F9EF4051FBA1B0D0063FBB0 /* mapbox_helmet.pdf */; }; @@ -133,6 +132,7 @@ CA8FBC0D21A4A74300D1203C /* MGLRendererConfigurationTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CA8FBC0C21A4A74300D1203C /* MGLRendererConfigurationTests.mm */; }; CA9461A620884CCB0015EB12 /* MGLAnnotationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = CA9461A520884CCB0015EB12 /* MGLAnnotationTests.m */; }; CAD9D0AC22A88A32001B25EE /* MGLResourceTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = CAD9D0AB22A88A32001B25EE /* MGLResourceTests.mm */; }; + CF762DEF22DC7EFF00338472 /* MGLLoggingConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = CF762DEE22DC7EFF00338472 /* MGLLoggingConfiguration.mm */; }; DA00FC8A1D5EEAC3009AABC8 /* MGLAttributionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = DA00FC881D5EEAC3009AABC8 /* MGLAttributionInfo.h */; settings = {ATTRIBUTES = (Public, ); }; }; DA00FC8B1D5EEAC3009AABC8 /* MGLAttributionInfo.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA00FC891D5EEAC3009AABC8 /* MGLAttributionInfo.mm */; }; DA0CD58E1CF56F5800A5F5A5 /* MGLFeatureTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = DA0CD58D1CF56F5800A5F5A5 /* MGLFeatureTests.mm */; }; @@ -348,7 +348,6 @@ 1F7454AA1ED1DDBD00021D39 /* MGLLightTest.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLLightTest.mm; sourceTree = ""; }; 1F8A59F921653483004DFE75 /* sideload_sat.db */ = {isa = PBXFileReference; lastKnownFileType = file; name = sideload_sat.db; path = ../../../test/fixtures/offline_database/sideload_sat.db; sourceTree = ""; }; 1F8A5A01216D4695004DFE75 /* MGLLoggingConfiguration_Private.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLLoggingConfiguration_Private.h; sourceTree = ""; }; - 1F8A5A02216D4695004DFE75 /* MGLLoggingConfiguration.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MGLLoggingConfiguration.m; sourceTree = ""; }; 1F8A5A03216D4696004DFE75 /* MGLLoggingConfiguration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLLoggingConfiguration.h; sourceTree = ""; }; 1F95931A1E6DE2B600D5B294 /* MGLNSDateAdditionsTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLNSDateAdditionsTests.mm; path = ../../darwin/test/MGLNSDateAdditionsTests.mm; sourceTree = ""; }; 1F9EF4051FBA1B0D0063FBB0 /* mapbox_helmet.pdf */ = {isa = PBXFileReference; lastKnownFileType = image.pdf; path = mapbox_helmet.pdf; sourceTree = ""; }; @@ -472,6 +471,7 @@ CA8FBC0C21A4A74300D1203C /* MGLRendererConfigurationTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLRendererConfigurationTests.mm; path = ../../darwin/test/MGLRendererConfigurationTests.mm; sourceTree = ""; }; CA9461A520884CCB0015EB12 /* MGLAnnotationTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = MGLAnnotationTests.m; path = test/MGLAnnotationTests.m; sourceTree = SOURCE_ROOT; }; CAD9D0AB22A88A32001B25EE /* MGLResourceTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLResourceTests.mm; path = ../../darwin/test/MGLResourceTests.mm; sourceTree = ""; }; + CF762DEE22DC7EFF00338472 /* MGLLoggingConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLLoggingConfiguration.mm; sourceTree = ""; }; DA00FC881D5EEAC3009AABC8 /* MGLAttributionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MGLAttributionInfo.h; sourceTree = ""; }; DA00FC891D5EEAC3009AABC8 /* MGLAttributionInfo.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MGLAttributionInfo.mm; sourceTree = ""; }; DA0CD58D1CF56F5800A5F5A5 /* MGLFeatureTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = MGLFeatureTests.mm; path = ../../darwin/test/MGLFeatureTests.mm; sourceTree = ""; }; @@ -1253,7 +1253,7 @@ DA87A99F1DC9DC6200810D09 /* MGLValueEvaluator.h */, 1F8A5A03216D4696004DFE75 /* MGLLoggingConfiguration.h */, 1F8A5A01216D4695004DFE75 /* MGLLoggingConfiguration_Private.h */, - 1F8A5A02216D4695004DFE75 /* MGLLoggingConfiguration.m */, + CF762DEE22DC7EFF00338472 /* MGLLoggingConfiguration.mm */, ); name = Foundation; path = ../darwin/src; @@ -1659,6 +1659,7 @@ 40B77E461DB11BCD003DA2FE /* NSArray+MGLAdditions.mm in Sources */, DAE6C38C1CC31E2A00DB3429 /* MGLOfflinePack.mm in Sources */, 35D65C5B1D65AD5500722C23 /* NSDate+MGLAdditions.mm in Sources */, + CF762DEF22DC7EFF00338472 /* MGLLoggingConfiguration.mm in Sources */, DD0902B21DB1AC6400C5BDCE /* MGLNetworkConfiguration.m in Sources */, 1F7454A51ECFB00300021D39 /* MGLLight.mm in Sources */, DAE6C3B11CC31EF300DB3429 /* MGLAnnotationImage.m in Sources */, @@ -1710,7 +1711,6 @@ DAE6C3921CC31E2A00DB3429 /* MGLPolyline.mm in Sources */, 3527428A1D4C245800A1ECE6 /* MGLShapeSource.mm in Sources */, DAE6C3B51CC31EF300DB3429 /* MGLCompassCell.m in Sources */, - 1F8A5A05216D4696004DFE75 /* MGLLoggingConfiguration.m in Sources */, DA8F25901D51CA600010E6B5 /* MGLRasterStyleLayer.mm in Sources */, DAD165751CF4CD7A001FF4B9 /* MGLShapeCollection.mm in Sources */, 92FC0AE6207CDD8D007B6B54 /* MGLShapeOfflineRegion.mm in Sources */, diff --git a/platform/macos/sdk-files.json b/platform/macos/sdk-files.json index 6bd767fb98..022f679b4a 100644 --- a/platform/macos/sdk-files.json +++ b/platform/macos/sdk-files.json @@ -13,6 +13,7 @@ "platform/darwin/src/NSArray+MGLAdditions.mm", "platform/darwin/src/MGLOfflinePack.mm", "platform/darwin/src/NSDate+MGLAdditions.mm", + "platform/darwin/src/MGLLoggingConfiguration.mm", "platform/darwin/src/MGLNetworkConfiguration.m", "platform/darwin/src/MGLLight.mm", "platform/macos/src/MGLAnnotationImage.m", @@ -64,7 +65,6 @@ "platform/darwin/src/MGLPolyline.mm", "platform/darwin/src/MGLShapeSource.mm", "platform/macos/src/MGLCompassCell.m", - "platform/darwin/src/MGLLoggingConfiguration.m", "platform/darwin/src/MGLRasterStyleLayer.mm", "platform/darwin/src/MGLShapeCollection.mm", "platform/darwin/src/MGLShapeOfflineRegion.mm", -- cgit v1.2.1