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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project logging #722

Merged
merged 5 commits into from Feb 1, 2017
Merged

Project logging #722

merged 5 commits into from Feb 1, 2017

Conversation

jodosha
Copy link
Member

@jodosha jodosha commented Jan 31, 2017

This PR introduces project level logging (Hanami.logger), automatic logging for HTTP requests, SQL queries, and migrations. It removes application level logging (Web.logger).

Example of logging with the default formatter (development):

[bookshelf] [INFO] [2017-01-31 18:23:12 +0100] (0.000389s) SELECT "id", "name" FROM "books" WHERE ("books"."id" = '1') ORDER BY "books"."id"
[bookshelf] [INFO] [2017-01-31 18:23:12 +0100] HTTP/1.1 GET 200 127.0.0.1 /books/1  451 0.018351

Example of logging with the JSON formatter (production):

{"app":"bookshelf","severity":"INFO","time":"2017-01-31T17:25:42Z","message":"(0.000389s) SELECT \"id\", \"name\" FROM \"books\" WHERE (\"books\".\"id\" = '1') ORDER BY \"books\".\"id\""}
{"app":"bookshelf","severity":"INFO","time":"2017-01-31T17:25:42Z","http":"HTTP/1.1","verb":"GET","status":"200","ip":"127.0.0.1","path":"/books/1","query":"","length":"451","elapsed":0.017913}

Closes #484

/cc @hanami/issues @hanami/ecosystem for review 馃憤

@jodosha jodosha added this to the v1.0.0.beta1 milestone Jan 31, 2017
@jodosha jodosha self-assigned this Jan 31, 2017
Copy link
Member

@davydovanton davydovanton left a comment

Choose a reason for hiding this comment

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

great work 馃憦

@davydovanton
Copy link
Member

@jodosha just a question: what do you think, will we have some problems with logger after switching from 0.9 to 1.0?

@jodosha
Copy link
Member Author

jodosha commented Jan 31, 2017

@davydovanton Which kind of problems?

@AlfonsoUceda
Copy link
Contributor

LGTM @jodosha

@jodosha jodosha merged commit 34662ad into master Feb 1, 2017
@jodosha jodosha deleted the project-logging branch February 1, 2017 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants