Pulse
Pulse copied to clipboard
[Question] - Is it possible to customize the title of an item in the console?
Hi,
I'm using Pulse logger to log some custom messages for a new GraphQL implementation which works very well. The only downside is since every URL resolves against localhost:4000/graphql/ all the items in the console have /graphql/ and there's no way to differntiate which request is which (see attached image). Is it possible to customize this label?
i'm using this code (Apollo client logging interceptor): `class LoggingInterceptor: ApolloInterceptor { var id: String = UUID().uuidString
func interceptAsync<Operation>(
chain: any RequestChain,
request: HTTPRequest<Operation>,
response: HTTPResponse<Operation>?,
completion: @escaping (Result<GraphQLResult<Operation.Data>, any Error>) -> Void
) where Operation: GraphQLOperation {
guard let urlRequest = try? request.toURLRequest() else {
print("GraphQL: We can't log anything without a valid request")
return
}
let operationName = String(describing: request.operation)
LoggerStore.shared.storeRequest(
urlRequest,
response: createURLResponse(response: response),
error: nil,
data: response?.rawData,
metrics: nil,
label: operationName,
taskDescription: operationName
)
chain.proceedAsync(request: request, response: response, interceptor: self, completion: completion)
}
private func createURLResponse<Operation>(response: HTTPResponse<Operation>?) -> URLResponse? {
guard let response = response, let responseURL = response.httpResponse.url else {
return nil
}
let urlResponse = URLResponse(
url: responseURL,
mimeType: response.httpResponse.mimeType ?? "",
expectedContentLength: Int(response.httpResponse.expectedContentLength),
textEncodingName: response.httpResponse.textEncodingName ?? ""
)
return urlResponse
}
}`
Setting this should do the trick!
UserSettings.shared.listDisplayOptions.content.showTaskDescription = true