File tree Expand file tree Collapse file tree
Sources/MapboxMaps/Foundation Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import Foundation
22@_implementationOnly import MapboxCommon_Private. MBXLog_Internal
3+ @_spi ( Logging) import MapboxCommon
34
45/// A logging utility with MapboxCommon backend by default.
56@_spi ( Logging) public struct Log {
@@ -38,26 +39,15 @@ import Foundation
3839 /// - Parameter category: The logging category to check. If `nil`, returns the global logging level.
3940 /// - Returns: The current logging level. Returns `.debug` if no level is configured.
4041 @_spi ( Logging) public static func loggingLevel( category: Category ? = nil ) -> LoggingLevel {
41- let level : NSNumber ?
42- if let category {
43- level = LogConfiguration . getLoggingLevel ( forCategory: logCategory ( category. rawValue) )
44- } else {
45- level = LogConfiguration . getLoggingLevel ( )
46- }
47- return ( level? . intValue) . flatMap ( LoggingLevel . init) ?? . debug
42+ return MapboxCommon . Log. loggingLevel ( category: logCategory ( category? . rawValue) )
4843 }
4944
5045 /// Set the logging level for a specific category or globally.
5146 /// - Parameters:
5247 /// - level: The logging level to set.
5348 /// - category: The logging category to configure. If `nil`, sets the global logging level.
5449 @_spi ( Logging) public static func setLogging( level: LoggingLevel , category: Category ? = nil ) {
55- let nsLevel = NSNumber ( value: level. rawValue)
56- if let category {
57- LogConfiguration . setLoggingLevelForCategory ( category. fullCategoryName, upTo: nsLevel)
58- } else {
59- LogConfiguration . setLoggingLevelForUpTo ( nsLevel)
60- }
50+ MapboxCommon . Log. setLogging ( level: level, category: category? . fullCategoryName)
6151 }
6252}
6353
You can’t perform that action at this time.
0 commit comments