Skip to content

Commit

Permalink
[MLModelDownloader] Use FirebaseLogger instead of GULLoggerWrapper (
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewheard authored Jun 20, 2024
1 parent ed85ff2 commit 04f0491
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
1 change: 0 additions & 1 deletion FirebaseCore/Extension/FIRLogger.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,6 @@ NS_SWIFT_NAME(FirebaseLogger)
/// three-character service identifier and a six digit integer message ID that is unique within
/// the service. An example of the message code is @"I-COR000001".
/// - message: Formatted string to be used as the log's message.
/// - args: Arguments list obtained from calling `va_start`, used when message is a format string.
+ (void)logWithLevel:(FIRLoggerLevel)level
service:(FIRLoggerService)service
code:(NSString *)code
Expand Down
3 changes: 1 addition & 2 deletions FirebaseMLModelDownloader.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ Pod::Spec.new do |s|

s.framework = 'Foundation'
s.dependency 'FirebaseCore', '~> 10.0'
s.dependency 'FirebaseCoreExtension', '~> 10.29'
s.dependency 'FirebaseInstallations', '~> 10.0'
s.dependency 'GoogleDataTransport', '~> 9.2'
# TODO: Revisit this dependency
s.dependency 'GoogleUtilities/Logger', '~> 7.13'
s.dependency 'GoogleUtilities/UserDefaults', '~> 7.13'
s.dependency 'SwiftProtobuf', '~> 1.19'

Expand Down
19 changes: 5 additions & 14 deletions FirebaseMLModelDownloader/Sources/DeviceLogger.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
// limitations under the License.

import Foundation
#if SWIFT_PACKAGE
@_implementationOnly import GoogleUtilities_Logger
#else
@_implementationOnly import GoogleUtilities
#endif

@_implementationOnly import FirebaseCoreExtension

/// Enum of log messages.
enum LoggerMessageCode: Int {
Expand Down Expand Up @@ -76,15 +73,9 @@ enum DeviceLogger {
/// Log identifier.
static let service = "[Firebase/MLModelDownloader]"

static func logEvent(level: GoogleLoggerLevel, message: String, messageCode: LoggerMessageCode) {
static func logEvent(level: FirebaseLoggerLevel, message: String,
messageCode: LoggerMessageCode) {
let code = String(format: "I-MLM%06d", messageCode.rawValue)
let args: [CVarArg] = []
GULLoggerWrapper.log(
with: level,
withService: DeviceLogger.service,
withCode: code,
withMessage: message,
withArgs: getVaList(args)
)
FirebaseLogger.log(level: level, service: DeviceLogger.service, code: code, message: message)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
@testable import FirebaseMLModelDownloader
import XCTest
#if SWIFT_PACKAGE
@_implementationOnly import GoogleUtilities_Logger
@_implementationOnly import GoogleUtilities_UserDefaults
#else
@_implementationOnly import GoogleUtilities
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,9 @@ let package = Package(
name: "FirebaseMLModelDownloader",
dependencies: [
"FirebaseCore",
"FirebaseCoreExtension",
"FirebaseInstallations",
.product(name: "GoogleDataTransport", package: "GoogleDataTransport"),
.product(name: "GULLogger", package: "GoogleUtilities"),
.product(name: "GULUserDefaults", package: "GoogleUtilities"),
.product(name: "SwiftProtobuf", package: "swift-protobuf"),
],
Expand Down

0 comments on commit 04f0491

Please sign in to comment.