Skip to content

Commit 675f8cd

Browse files
committed
address feedbacks
1 parent 888dd14 commit 675f8cd

File tree

5 files changed

+28
-28
lines changed

5 files changed

+28
-28
lines changed

Package.resolved

Lines changed: 8 additions & 8 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Sources/DataConnect.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import Foundation
1717
import FirebaseAppCheck
1818
import FirebaseAuth
1919
import FirebaseCore
20-
import OSLog
2120

2221
@available(iOS 15.0, macOS 12.0, tvOS 15.0, watchOS 8.0, *)
2322
public class DataConnect {

Sources/Internal/CodableTimestamp.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ extension CodableTimestamp {
5353
length: timestampString.count)) !=
5454
nil else {
5555
DataConnectLogger.error(
56-
"Timestamp string \(timestampString) format doesn't support."
56+
"Timestamp string format \(timestampString) is not supported."
5757
)
5858
throw DataConnectError.invalidTimestampFormat
5959
}

Sources/Internal/GrpcClient.swift

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ actor GrpcClient: CustomStringConvertible {
6363
private lazy var client: FirebaseDataConnectAsyncClient? = {
6464
do {
6565
DataConnectLogger
66-
.debug("GrpcClient\(self.description, privacy: .private) initialization starts.")
66+
.debug("GrpcClient: \(self.description, privacy: .private) initialization starts.")
6767
let group = PlatformSupport.makeEventLoopGroup(loopCount: threadPoolSize)
6868
let channel = try GRPCChannelPool.with(
6969
target: .host(serverSettings.host, port: serverSettings.port),
@@ -72,11 +72,12 @@ actor GrpcClient: CustomStringConvertible {
7272
.plaintext,
7373
eventLoopGroup: group
7474
)
75-
DataConnectLogger.debug("GrpcClient\(self.description, privacy: .private) has been created.")
75+
DataConnectLogger
76+
.debug("GrpcClient: \(self.description, privacy: .private) has been created.")
7677
return FirebaseDataConnectAsyncClient(channel: channel)
7778
} catch {
7879
DataConnectLogger
79-
.debug("Error:\(error) when creating GrpcClient\(self.description, privacy: .private).")
80+
.debug("Error:\(error) when creating GrpcClient: \(self.description, privacy: .private).")
8081
return nil
8182
}
8283
}()
@@ -117,7 +118,7 @@ actor GrpcClient: CustomStringConvertible {
117118
googRequestHeaderValue = "location=\(self.connectorConfig.location)&frontend=data"
118119

119120
description = """
120-
: projectId=\(projectId) \
121+
projectId=\(projectId) \
121122
connector=\(connectorConfig.connector) \
122123
host=\(serverSettings.host) \
123124
port=\(serverSettings.port) \
@@ -140,27 +141,27 @@ actor GrpcClient: CustomStringConvertible {
140141
connectorName: connectorName,
141142
request: request
142143
)
143-
let requestString = try ": " + grpcRequest.jsonString()
144+
let requestString = try grpcRequest.jsonString()
144145

145146
do {
146147
DataConnectLogger
147-
.debug("executeQuery() sends grpc request\(requestString, privacy: .private).")
148+
.debug("executeQuery() sends grpc request: \(requestString, privacy: .private).")
148149
let results = try await client.executeQuery(grpcRequest, callOptions: createCallOptions())
149-
let resultsString = try ": " + results.jsonString()
150+
let resultsString = try results.jsonString()
150151
DataConnectLogger
151-
.debug("executeQuery() receives response\(resultsString, privacy: .private).")
152+
.debug("executeQuery() receives response: \(resultsString, privacy: .private).")
152153
// Not doing error decoding here
153154
if let decodedResults = try codec.decode(result: results.data, asType: resultType) {
154155
return OperationResult(data: decodedResults)
155156
} else {
156157
// In future, set this as error in OperationResult
157158
DataConnectLogger
158-
.debug("executeQuery() response\(resultsString, privacy: .private) decode failed.")
159+
.debug("executeQuery() response: \(resultsString, privacy: .private) decode failed.")
159160
throw DataConnectError.decodeFailed
160161
}
161162
} catch {
162163
DataConnectLogger.error(
163-
"executeQuery()\(requestString, privacy: .private) grpc call FAILED with \(error)."
164+
"executeQuery(): \(requestString, privacy: .private) grpc call FAILED with \(error)."
164165
)
165166
throw error
166167
}
@@ -183,25 +184,25 @@ actor GrpcClient: CustomStringConvertible {
183184
request: request
184185
)
185186

186-
let requestString = try ": " + grpcRequest.jsonString()
187+
let requestString = try grpcRequest.jsonString()
187188

188189
do {
189190
DataConnectLogger
190-
.debug("executeMutation() sends grpc request \(requestString, privacy: .private).")
191+
.debug("executeMutation() sends grpc request: \(requestString, privacy: .private).")
191192
let results = try await client.executeMutation(grpcRequest, callOptions: createCallOptions())
192-
let resultsString = try ": " + results.jsonString()
193+
let resultsString = try results.jsonString()
193194
DataConnectLogger
194-
.debug("executeMutation() receives response\(resultsString, privacy: .private).")
195+
.debug("executeMutation() receives response: \(resultsString, privacy: .private).")
195196
if let decodedResults = try codec.decode(result: results.data, asType: resultType) {
196197
return OperationResult(data: decodedResults)
197198
} else {
198199
DataConnectLogger
199-
.debug("executeMutation() response\(resultsString, privacy: .private) decode failed.")
200+
.debug("executeMutation() response: \(resultsString, privacy: .private) decode failed.")
200201
throw DataConnectError.decodeFailed
201202
}
202203
} catch {
203204
DataConnectLogger.error(
204-
"executeMutation()\(requestString, privacy: .private) grpc call FAILED with \(error)."
205+
"executeMutation(): \(requestString, privacy: .private) grpc call FAILED with \(error)."
205206
)
206207
throw error
207208
}

Sources/Internal/Logger/DataConnectLogger.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
import FirebaseCore
16-
import OSLog
16+
import os
1717

1818
let privateLogDisabledArgument = "-FIRPrivateLogDisabled"
1919

@@ -86,7 +86,7 @@ enum LogPrivacy {
8686
extension DefaultStringInterpolation {
8787
mutating func appendInterpolation(_ value: String, privacy: LogPrivacy = .public) {
8888
if privacy == .private, DataConnectLogger.privateLoggingEnabled {
89-
appendLiteral(" <private>")
89+
appendLiteral("<private>")
9090
} else {
9191
appendLiteral(value)
9292
}

0 commit comments

Comments
 (0)