This is useful for APIs that might have sensitive information in the query string, such as API keys.
This patch does not change the default behavior of the code unless the new `SkipQueryString` config option is passed in.
The "skip" term is a bit of a misnomer here, as this doesn't actually skip that log, but modifies the output. I'm open to suggestions for a more appropriate name.
`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>
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.
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
* 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
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().