forked from mirror/gin
doc(readme): update writing logs section wording. (#1074)
* doc(readme): update writing logs section wording. * doc(readme): update writing logs section wording. * doc(readme): fix word formatting
This commit is contained in:
parent
8be30bd382
commit
80152ac82c
11
README.md
11
README.md
|
@ -413,16 +413,17 @@ func main() {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### Output log to file
|
### How to write log file
|
||||||
```go
|
```go
|
||||||
func main() {
|
func main() {
|
||||||
// Disable Console Color, because not need color when output log to file
|
// Disable Console Color, you don't need console color when writing the logs to file.
|
||||||
gin.DisableConsoleColor()
|
gin.DisableConsoleColor()
|
||||||
// Create one file to save logs
|
|
||||||
|
// Logging to a file.
|
||||||
f, _ := os.Create("gin.log")
|
f, _ := os.Create("gin.log")
|
||||||
// Reset gin.DefaultWriter
|
|
||||||
gin.DefaultWriter = io.MultiWriter(f)
|
gin.DefaultWriter = io.MultiWriter(f)
|
||||||
// If need to output log to file and console at a time, please use the following code:
|
|
||||||
|
// Use the following code if you need to write the logs to file and console at the same time.
|
||||||
// gin.DefaultWriter = io.MultiWriter(f, os.Stdout)
|
// gin.DefaultWriter = io.MultiWriter(f, os.Stdout)
|
||||||
|
|
||||||
router := gin.Default()
|
router := gin.Default()
|
||||||
|
|
Loading…
Reference in New Issue