Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Logging Handler #36

Closed
wants to merge 9 commits into from
Closed

Logging Handler #36

wants to merge 9 commits into from

Conversation

jobala
Copy link
Contributor

@jobala jobala commented Feb 1, 2022

Overview

Adds a logging handler

Demo

trace := httptrace.ClientTrace{
  GotConn: func(info httptrace.GotConnInfo) {
        // do something with the info
  },
}


logHandler := NewLoggingHandler(&trace)
client := GetDefaultClient(nil, logHandler)
client.Get("https://example.com")

Notes

N/A

Testing

  • Create a ClientTrace object
  • Create a logging handler with NewLoggingHandler and pass the ClientTrace object.
  • Create a client with core lib's NewDefaultClient and pass the logging handler
  • Make a request and observe that the callback specified in the ClientTrace object gets called.

Closes #31

@sonarcloud
Copy link

sonarcloud bot commented Feb 1, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

100.0% 100.0% Coverage
0.0% 0.0% Duplication

@@ -16,3 +16,6 @@

# Jetbrains files
.idea/

# kiota
kiota/
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious to why this is part of the gitignore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not part of the core-lib and I have come close to git adding it a number of times.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah because you're cloning the kiota repo under that structure?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yap

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, this will resolve itself when we close this PR in favor to the one in kiota.
FYI I either use submodules (when no other references options are available) or relative paths (outside of the repo) to avoid this kind of confusion.

@@ -0,0 +1,25 @@
package msgraphgocore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be part of kiota http and not just msgraph core as it could benefit people building clients for other APIs than MS Graph.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean I duplicate the effort in both repos? Or I just move this to Kiota?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just move it

@jobala jobala closed this Feb 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Logging Handler
2 participants