Manuel Alonso
a71af9c144
removing log injection ( #2277 )
...
Co-authored-by: thinkerou <thinkerou@gmail.com>
2020-03-07 21:51:33 +08:00
Kaushik Neelichetty
5f56109bcf
Use json marshall in context json to fix breaking new line issue. Fixes #2209 ( #2228 )
...
* ignore IntelliJ idea generated files
* update JSON renderer to use Marshall() instead of Encode(). Fix #2209
* Revert "ignore IntelliJ idea generated files"
This reverts commit e7bd017227df5dbd2ed2f5fe353adb5f1b08c678.
Co-authored-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: thinkerou <thinkerou@gmail.com>
2020-02-21 17:15:17 +08:00
Shuo
a22377b09b
logger_test: color ( #1926 )
...
* logger color: string literals
* logger_test: color
2019-08-29 08:32:22 +08:00
itcloudy
0cbf290302
use encode replace json marshal increase json encoder speed ( #1546 )
2019-05-22 07:48:50 +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
Sai
f7079a861e
Delete dupilicated test ( #1801 )
2019-03-08 19:44:39 +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
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
Dmitry Kutakov
b056a34bdc
fix errcheck warnings ( #1739 )
2019-01-18 09:32:53 +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
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
田欧
eeb57848ca
update assert param(expect, actual) position ( #1177 )
2017-11-21 21:18:45 +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
cssivision
f4dec22c50
fix: buffer should reset when test logger output ( #819 )
2017-02-28 15:15:52 +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
Bo-Yi Wu
787bff85e5
fix testing.
...
Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2016-12-11 10:14:23 +08: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
Manu Mtz.-Almeida
e9531e5c76
Merge branch 'master' into develop
2016-01-26 20:08:28 +01:00
shadrus
13ba260d76
Wrong copy/paste TODO
2015-10-05 22:27:03 +03:00
Roman Zaynetdinov
f13c3ae898
Add option to skip logging specified endpoints
2015-07-22 17:02:36 +03:00
Manu Mtz-Almeida
c9272120b4
Adds unit tests for ErrorLogger()
2015-07-04 20:15:15 +02:00
Kevin Mulvey
7469025182
forgot the default of ColorForMethod
2015-05-27 20:53:28 -04:00
Kevin Mulvey
1b031cb271
Added tests for colorForMethod() and colorForStatus()
2015-05-27 20:36:37 -04:00
Manu Mtz-Almeida
99694bb716
Fixes errors
2015-05-12 15:22:13 +02:00
Manu Mtz-Almeida
0a192fb0fa
Tons of unit tests
2015-04-09 12:15:02 +02:00