jincheng9
830a63d244
fix: typo ( #2973 )
...
* fix: typo
* fix: grammar error
2021-12-02 18:00:24 +08:00
y-yagi
4fe5f3e4b4
Use `Duration.Truncate` for truncating precision ( #2711 )
...
`Duration.Truncate` was added in Go 1.9 and Gin required Go version 1.13+ now.
So we can use `Duration.Truncate`.
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2021-05-04 22:38:14 +08:00
Manuel Alonso
a71af9c144
removing log injection ( #2277 )
...
Co-authored-by: thinkerou <thinkerou@gmail.com>
2020-03-07 21:51:33 +08:00
thinkerou
d5f12ac6d7
use http method constant ( #2155 )
...
* use http method constant
* fix typo
2019-11-29 07:50:49 +08:00
Shuo
a22377b09b
logger_test: color ( #1926 )
...
* logger color: string literals
* logger_test: color
2019-08-29 08:32:22 +08:00
Dan Markham
ce20f107f5
Truncate Latency precision in long running request ( #1830 )
...
fixes #1823
2019-03-28 14:14:00 +08:00
Sai
b40d4c175c
IsTerm flag should not be affected by DisableConsoleColor method. ( #1802 )
...
* IsTerm flag should not be affected by DisableConsoleColor method.
* change public property to private
2019-03-18 11:12:30 +08:00
Adam Zielinski
3dc247893e
make context.Keys available as LogFormatterParams ( #1779 )
...
* make context available as LogFormatterParams
* pass context Keys to LogFormatterParams
* update logger test to check for Key param
2019-03-07 09:47:31 +08:00
Sai
e6288e90eb
Change color methods in using defaultLogger function to public ( #1771 )
...
Fix https://github.com/gin-gonic/gin/issues/1768
2019-02-22 16:48:55 +08:00
Pierre Massat
184661cfa2
Add response size to LogFormatterParams ( #1752 )
2019-02-22 13:12:05 +08:00
Olivier Robardet
a58a2f9bf3
Add a function to force color in console output ( #1724 )
...
Add a function `ForceConsoleColor`, like `DisableConsoleColor` but to force coloring the output.
It usefull when some IDE's integrated console (like IntelliJ or Goland) are not detected as TTY, but can display colors.
Also helps if one want to output color in log file (#1590 ) and as a workaround for #1547 .
2019-02-20 21:14:16 +08:00
Sai
b4f5155982
Fix not to pass formatted string to Fprintf's format specifier parameter ( #1747 )
2019-01-20 08:39:09 +08:00
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