Skip to content

Commit 3cb6319

Browse files
tatiana-yangithub-actions[bot]
authored andcommitted
[ios][logger] Add logger helper for darwin platform
GitOrigin-RevId: 9f1ef7b735187846f1fff04cfa75c25c56332a6b
1 parent eb9890e commit 3cb6319

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

Sources/MapboxMaps/Foundation/Logger.swift

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import 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

0 commit comments

Comments
 (0)