Merge pull request #1941 from ahoppen/log-request-names

Log the request methods when logging a request's reply
This commit is contained in:
Alex Hoppen
2025-01-24 14:12:54 -08:00
committed by GitHub
3 changed files with 6 additions and 2 deletions

View File

@@ -138,6 +138,7 @@ package final class LocalConnection: Connection, Sendable {
logger.info(
"""
Received reply for request \(id, privacy: .public) from \(self.name, privacy: .public)
\(Request.method, privacy: .public)
\(response.forLogging)
"""
)
@@ -145,6 +146,7 @@ package final class LocalConnection: Connection, Sendable {
logger.error(
"""
Received error for request \(id, privacy: .public) from \(self.name, privacy: .public)
\(Request.method, privacy: .public)
\(error.forLogging)
"""
)

View File

@@ -192,7 +192,7 @@ extension QueueBasedMessageHandler {
)
.makeSignposter()
let signpostID = signposter.makeSignpostID()
let state = signposter.beginInterval("Notification", id: signpostID, "\(type(of: notification))")
let state = signposter.beginInterval("Notification", id: signpostID, "\(type(of: notification).method)")
messageHandlingQueue.async(metadata: DependencyTracker(notification)) {
signposter.emitEvent("Start handling", id: signpostID)
await self.handle(notification: notification)
@@ -209,7 +209,7 @@ extension QueueBasedMessageHandler {
let signposter = Logger(subsystem: LoggingScope.subsystem, category: messageHandlingHelper.signpostLoggingCategory)
.makeSignposter()
let signpostID = signposter.makeSignpostID()
let state = signposter.beginInterval("Request", id: signpostID, "\(Request.self)")
let state = signposter.beginInterval("Request", id: signpostID, "\(Request.method)")
self.didReceive(request: request, id: id)

View File

@@ -708,6 +708,7 @@ public final class JSONRPCConnection: Connection {
logger.info(
"""
Received reply for request \(id, privacy: .public) from \(self.name, privacy: .public)
\(Request.method, privacy: .public)
\(response.forLogging)
"""
)
@@ -715,6 +716,7 @@ public final class JSONRPCConnection: Connection {
logger.error(
"""
Received error for request \(id, privacy: .public) from \(self.name, privacy: .public)
\(Request.method, privacy: .public)
\(error.forLogging)
"""
)