firebase / firebase-admin-dotnet

Firebase Admin .NET SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
367 stars 131 forks source link

Support logging request & response while sending push message to server #128

Closed redplane closed 4 years ago

redplane commented 4 years ago

Hi team,

I am using FirebaseAdmin for my project. Currently, I don't see any any callback or delegate to help me to get the information of the requests | responses that are sent | recevied to | from firebase cloud messaging service.

I notice there is one property in AppOption named HttpClientFactory. I wonder there are any examples about that to log the request | response or not. For now, I don't know how to implement logging without affecting to the library settings.

Thanks

hiranya911 commented 4 years ago

Haven't tried this myself, but perhaps you can implement an HttpClientFactory that returns an HttpMessageHandler like this one: https://stackoverflow.com/a/18925296/5190886

Let us know if you manage to get it to work.

redplane commented 4 years ago

I have seen your source code. You are wrapping httpClient while initializing firebase app instance. I wonder how we can apply HttpClientHandler to those instances.

I think you can expose a delegate from firebase app instead.

hiranya911 commented 4 years ago

HttpClientFactory has a CreateHandler() method that can be overridden for this. I'd expect that approach to work.

https://github.com/googleapis/google-api-dotnet-client/blob/master/Src/Support/Google.Apis.Core/Http/HttpClientFactory.cs

redplane commented 4 years ago

Ok, thank you. I'll try and update you later.

hiranya911 commented 4 years ago

I'm going to close this as I don't see any pending action items for this repo. Please feel free to reopen if we've missed something.