Skip to content

Conversation

@instabledesign
Copy link
Member

@instabledesign instabledesign commented Dec 2, 2019

will log something similar to
OK

<info> http client GET http://www.google.fr/ [status_code:200, duration:75.660397ms, content_length:-1] {"http_response_length":-1,"http_method":"GET","http_url":"http://www.google.fr/","http_request_deadline":"2019-12-02T11:36:47+01:00","http_kind":"client","http_start_time":"2019-12-02T11:36:44+01:00","http_duration":0.075660397,"http_status":"200 OK","http_status_code":200}

Transport error

<error> http client error GET http://a.zz.fr [duration:61.762422ms] dial tcp: lookup a.zz.fr: no such host {"http_request_deadline":"2019-12-02T11:39:05+01:00","http_kind":"client","http_duration":0.061752453,"http_error":{"Op":"dial","Net":"tcp","Source":null,"Addr":null,"Err":{"Err":"no such host","Name":"a.zz.fr","Server":"","IsTimeout":false,"IsTemporary":false,"IsNotFound":true}},"http_error_message":"dial tcp: lookup a.zz.fr: no such host","http_method":"GET","http_url":"http://a.zz.fr","http_start_time":"2019-12-02T11:39:02+01:00"}

Transport panic

<critical> http client panic GET http://google.fr [duration:317.573µs] {"http_method":"GET","http_url":"http://google.fr","http_start_time":"2019-12-02T11:38:05+01:00","http_request_deadline":"2019-12-02T11:38:08+01:00","http_kind":"client","http_duration":0.000317573,"http_panic":"my transport panic"}

@instabledesign instabledesign force-pushed the init-tripperware branch 3 times, most recently from 4148297 to b0b6d03 Compare December 2, 2019 14:03
@instabledesign instabledesign changed the title init logger tripperware init logger tripperware/middleware Dec 2, 2019
@instabledesign instabledesign force-pushed the init-tripperware branch 2 times, most recently from c320060 to 86b698a Compare December 6, 2019 09:04
}
}

func FeedContext(loggerContext *logger.Context, ctx context.Context, req *http.Request, startTime time.Time) *logger.Context {
Copy link
Member

Choose a reason for hiding this comment

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

add some doc 👍

qneyrat
qneyrat previously approved these changes Dec 12, 2019
)

// InjectLogger will inject logger on request context if not exist
// this injection was made for every incoming request so prefer to
Copy link
Member

Choose a reason for hiding this comment

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

is made

Copy link
Member

@pimousse1099 pimousse1099 left a comment

Choose a reason for hiding this comment

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

Do you have some tests with a global context and multiple requests in order to check that global logger is not affected by other loggers (i.e request scoped loggers) ?

"github.com/gol4ng/logger-http/tripperware"
"github.com/gol4ng/logger/formatter"
"github.com/gol4ng/logger/handler"
"github.com/stretchr/testify/assert"
Copy link
Member

Choose a reason for hiding this comment

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

a little sort 👍

@instabledesign instabledesign force-pushed the init-tripperware branch 7 times, most recently from 88a0d03 to 7a8924d Compare December 13, 2019 16:27
@instabledesign instabledesign merged commit cf0801e into master Dec 13, 2019
@instabledesign instabledesign deleted the init-tripperware branch December 13, 2019 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants