Commit Graph

61 Commits

Author SHA1 Message Date
Sai 2d33c82028 Add comment to LogFormatterParams struct's fields (#1711)
By https://github.com/gin-gonic/gin/issues/1701, I thought it's necessary.
2018-12-25 23:27:24 +08:00
Sai 678e09c736 Plural is "Paths", not "Pathes" (#1706) 2018-12-20 17:54:08 +08:00
Sai f76ccb25f1 Add LoggerWithFormatter method (#1677)
* Add LoggerWithFormatter

* Add tests for LoggerWithFormatter & LoggerWithConfig

* Add note for README

* Add tests for DefaultLogFormatter

* Add comment

* Change DefaultLogFormatter to a private method
2018-12-12 09:05:16 +08:00
Barnabus 7a374f9a47 Fix typos (#1626) 2018-11-05 14:17:04 +08:00
andrea fd599fccea Make logger use a yellow background and a darkgray text for legibility (#1570)
1. Why is this change neccesary?
White text on a yellow background was illegible with most terminal color schemes

2. How does it address the issue?
The white text was replaced with a bash compatible dark gray while keeping the
yellow background colour

3. What side effects does this change have?
Resolves #1552
2018-09-26 10:28:25 +08:00
田欧 f45c928a15 chore: use http.Status* instead of hard code (#1482) 2018-08-14 09:51:56 +08:00
田欧 f4c9ac17a4 not display color when set disableColor (#1072) 2017-08-22 10:27:28 +08:00
田欧 a8fa424ae5 update comment (#1057) 2017-08-16 11:55:50 +08:00
田欧 52c2ed34b3 log format (#1060) 2017-08-14 14:34:29 +08:00
Bo-Yi Wu e31cbdf241 feat(logger): show query string in logger. (#999) close #988
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2017-07-10 10:41:20 +02:00
Javier Provecho Fernandez 484acfc303 docs(logger): add missing inline docs 2017-07-02 17:05:21 +02:00
Bo-Yi Wu 28b18cd1fb feat: support cygwin for log writer. (#834) 2017-03-15 20:15:41 -05:00
novaeye 75c2274b4b better display for log message (#623) 2017-01-05 16:29:33 +08:00
Bo-Yi Wu d158ef2e82 Support disable console color.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-12-21 14:41:47 +08:00
Javier Provecho Fernandez 2ee06db79a Merge pull request #627 from liudanking/develop
Fix log color reset
2016-12-05 10:49:16 +01:00
Bo-Yi Wu 38e4b1d2fe Support google appengine for IsTerminal func.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-12-04 09:50:02 +08:00
Bo-Yi Wu b26d956e07 fix #752 ignore appengine os.
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-12-04 00:30:59 +08:00
Javier Provecho Fernandez 32cab500ec v1.1 (#751)
* Implement QueryArray and PostArray methods

* Refactor GetQuery and GetPostForm

* Removed additional Iota

I think assigning iota to each constant is not required

* Add 1.7 test.

* Add codecov.io

* corrected a typo in README

* remove coveralls services.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>

* Update TravisCI to Gitter webhook

* Add codecov.yml Gitter webhook

* Changed imports to gopkg instead of github in README (#733)

* Add contribution guide

* Update go get for stable version

In the future, github default branch will be develop so running `go get github.com/gin-gonic/gin` will pull latest code from develop.

* Changed imports to gopkg instead of github in README

* Update README.md

* Logger: skip ANSI color commands if output is not a tty
2016-12-03 10:10:40 +01:00
Danieliu 30f014c754 fix default log format
`reset` field should be after `method` in LoggerWithWriter function.
2016-05-26 16:21:50 +08:00
Javier Provecho Fernandez 9e930b9bdd lint code 2016-04-15 01:16:46 +02:00
Roy Lou 4c4444b160 Write header immediately in AbortWithStatus()
Otherwise, caller needs to invoke WriteHeaderNow himself after
AbortWithStatus(), which is error-prone.

Also modified ErrorLoggerT() such that it always writes log to response
body. Otherwise calling AbortWithStatus() will fail to write body because
c.Writer.Written() is set true by WriteHeaderNow().
2016-04-15 00:02:29 +08:00
Roman Zaynetdinov f13c3ae898 Add option to skip logging specified endpoints 2015-07-22 17:02:36 +03:00
Manu Mtz-Almeida d6425f1692 We do not longer have to call JSON() explicitly 2015-06-13 16:42:12 +02:00
Manu Mtz-Almeida dde06a07f0 Logger only prints internal errors 2015-06-06 17:24:16 +02:00
Manu Mtz-Almeida 48633f7001 Better documentation 2015-05-29 21:03:41 +02:00
Manu Mtz-Almeida 2ebb6dcb95 Using uint64 for ErrorType 2015-05-23 01:59:36 +02:00
Manu Mtz-Almeida 71bd9f4500 New JSON error facilities 2015-05-22 04:43:43 +02:00
Manu Mtz-Almeida 3948dac8c4 Cosmetic change in logger() 2015-05-14 04:38:33 +02:00
Manu Mtz-Almeida 99694bb716 Fixes errors 2015-05-12 15:22:13 +02:00
Manu Mtz-Almeida d6771dc4a5 Cosmetic changes 2015-05-09 03:35:31 +02:00
Manu Mtz-Almeida ac0ad2fed8 Improves unit tests 2015-04-08 02:58:35 +02:00
Manu Mtz-Almeida 67f8f6bb69 Captures the path before any middleware modifies it 2015-04-07 23:49:53 +02:00
Manu Mtz-Almeida 873aecefa9 Renames DefaultLogFile to DefaultWriter 2015-04-07 23:34:16 +02:00
Manu Mtz-Almeida 3fce8efcc6 Renames LoggerInFile() to LoggerWithFile() 2015-04-07 18:56:17 +02:00
Manu Mtz-Almeida dcdf7b92f4 Error middleware does not write if the it is already written 2015-04-07 18:52:33 +02:00
Manu Mtz-Almeida 6c788a4300 Adds default file log option 2015-04-07 18:37:17 +02:00
Manu Mtz-Almeida 48fec0650d Cosmetic changes 2015-03-23 06:03:12 +01:00
Javier Provecho Fernandez dc0091006b Reorder logger.go imports 2015-03-08 14:19:50 +01:00
Yasuhiro Matsumoto e769b5dd37 colorful logger on windows 2015-03-04 13:14:10 +09:00
Manu Mtz-Almeida aa7b00a083 General refactoring. Part 2. 2014-10-09 01:40:42 +02:00
Manu Mtz-Almeida b4a6510edf Enables colored tag for http method in gin.Logger() 2014-09-13 15:51:29 +02:00
Damon Zhao 953c589b32 change %4s to %-7s for align 2014-09-13 12:40:37 +08:00
Damon Zhao 6634f04d9b (feature)add http method log-color,like http response status code 2014-09-05 15:53:53 +08:00
Manu Mtz-Almeida 8e5397bfa0 Adds in-code license 2014-08-29 19:49:50 +02:00
Manu Mtz-Almeida dcafad3ced Deferring WriteHeader. Part 1 2014-08-18 05:24:48 +02:00
Manu Mtz-Almeida 78c7101ff6 Check existence of X-Forwarded-For by comparing the length 2014-08-18 04:52:01 +02:00
Manu Mtz-Almeida f63a354b40 Normal log and error log are printed in the same call. 2014-07-13 00:18:33 +02:00
Manu Mtz-Almeida 2078ecd8e1 Renaming Context.Req to Context.Request 2014-07-08 16:57:04 +02:00
Dmitry Sedykh 9880758ddb No repeat call c.Writer.Status() 2014-07-08 16:07:59 +04:00
Manu Mtz-Almeida 25e7330e65 Merge branch 'sync_pool' into develop
Conflicts:
	logger.go
2014-07-08 01:13:52 +02:00