mirror of https://github.com/gofiber/fiber.git
fix md syntax
parent
ab382cdd4a
commit
ef561694ba
|
@ -537,7 +537,8 @@ agent.SetResponse(resp)
|
|||
ReleaseResponse(resp)
|
||||
```
|
||||
|
||||
<details><summary>Example handling for response values</summary>
|
||||
<details>
|
||||
<summary>Example handling for response values</summary>
|
||||
|
||||
```go title="Example handling response"
|
||||
// Create a Fiber HTTP client agent
|
||||
|
|
|
@ -92,20 +92,19 @@ app.Use(logger.New(logger.Config{
|
|||
|
||||
### Config
|
||||
|
||||
| Property | Type | Description | Default |
|
||||
|:-----------------|:---------------------------|:---------------------------------------------------------------------------------------------------------------------------------|:-------------------------|
|
||||
| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
|
||||
| Done | `func(*fiber.Ctx, []byte)` | Done is a function that is called after the log string for a request is written to Output, and pass the log string as parameter. | `nil` |
|
||||
| CustomTags | `map[string]LogFunc` | tagFunctions defines the custom tag action. | `map[string]LogFunc` |
|
||||
| Format | `string` | Format defines the logging tags. | `${time} | ${status} | ${latency} | ${ip} | ${method} | ${path} | ${error}\n` |
|
||||
| TimeFormat | `string` | TimeFormat defines the time format for log timestamps. | `15:04:05` |
|
||||
| TimeZone | `string` | TimeZone can be specified, such as "UTC" and "America/New_York" and "Asia/Chongqing", etc | `"Local"` |
|
||||
| TimeInterval | `time.Duration` | TimeInterval is the delay before the timestamp is updated. | `500 * time.Millisecond` |
|
||||
| Output | `io.Writer` | Output is a writer where logs are written. | `os.Stdout` |
|
||||
| DisableColors | `bool` | DisableColors defines if the logs output should be colorized. | `false` |
|
||||
| enableColors | `bool` | Internal field for enabling colors in the log output. (This is not a user-configurable field) | - |
|
||||
| enableLatency | `bool` | Internal field for enabling latency measurement in logs. (This is not a user-configurable field) | - |
|
||||
| timeZoneLocation | `*time.Location` | Internal field for the time zone location. (This is not a user-configurable field) | - |
|
||||
| Property | Type | Description | Default |
|
||||
|:-----------------|:---------------------------|:---------------------------------------------------------------------------------------------------------------------------------|:------------------------------------------------------------------------------------|
|
||||
| Next | `func(*fiber.Ctx) bool` | Next defines a function to skip this middleware when returned true. | `nil` |
|
||||
| Done | `func(*fiber.Ctx, []byte)` | Done is a function that is called after the log string for a request is written to Output, and pass the log string as parameter. | `nil` |
|
||||
| CustomTags | `map[string]LogFunc` | tagFunctions defines the custom tag action. | `map[string]LogFunc` |
|
||||
| Format | `string` | Format defines the logging tags. | `${time} \| ${status} \| ${latency} \| ${ip} \| ${method} \| ${path} \| ${error}\n` || TimeFormat | `string` | TimeFormat defines the time format for log timestamps. | `15:04:05` |
|
||||
| TimeZone | `string` | TimeZone can be specified, such as "UTC" and "America/New_York" and "Asia/Chongqing", etc | `"Local"` |
|
||||
| TimeInterval | `time.Duration` | TimeInterval is the delay before the timestamp is updated. | `500 * time.Millisecond` |
|
||||
| Output | `io.Writer` | Output is a writer where logs are written. | `os.Stdout` |
|
||||
| DisableColors | `bool` | DisableColors defines if the logs output should be colorized. | `false` |
|
||||
| enableColors | `bool` | Internal field for enabling colors in the log output. (This is not a user-configurable field) | - |
|
||||
| enableLatency | `bool` | Internal field for enabling latency measurement in logs. (This is not a user-configurable field) | - |
|
||||
| timeZoneLocation | `*time.Location` | Internal field for the time zone location. (This is not a user-configurable field) | - |
|
||||
|
||||
## Default Config
|
||||
```go
|
||||
|
|
|
@ -150,19 +150,19 @@ Constraints aren't validation for parameters. If constraints aren't valid for a
|
|||
|
||||
| Constraint | Example | Example matches |
|
||||
| ----------------- | ------------------------------------ | ------------------------------------------------------------------------------------------- |
|
||||
| int | :id<int\> | 123456789, -123456789 |
|
||||
| bool | :active<bool\> | true,false |
|
||||
| guid | :id<guid\> | CD2C1638-1638-72D5-1638-DEADBEEF1638 |
|
||||
| float | :weight<float\> | 1.234, -1,001.01e8 |
|
||||
| minLen(value) | :username<minLen(4)\> | Test (must be at least 4 characters) |
|
||||
| maxLen(value) | :filename<maxLen(8)\> | MyFile (must be no more than 8 characters |
|
||||
| len(length) | :filename<len(12)\> | somefile.txt (exactly 12 characters) |
|
||||
| min(value) | :age<min(18)\> | 19 (Integer value must be at least 18) |
|
||||
| max(value) | :age<max(120)\> | 91 (Integer value must be no more than 120) |
|
||||
| range(min,max) | :age<range(18,120)\> | 91 (Integer value must be at least 18 but no more than 120) |
|
||||
| alpha | :name<alpha\> | Rick (String must consist of one or more alphabetical characters, a-z and case-insensitive) |
|
||||
| datetime | :dob<datetime(2006\\\\-01\\\\-02)\> | 2005-11-01 |
|
||||
| regex(expression) | :date<regex(\\d{4}-\\d{2}-\\d{2})\> | 2022-08-27 (Must match regular expression) |
|
||||
| int | `:id<int\>` | 123456789, -123456789 |
|
||||
| bool | `:active<bool\>` | true,false |
|
||||
| guid | `:id<guid\>` | CD2C1638-1638-72D5-1638-DEADBEEF1638 |
|
||||
| float | `:weight<float\>` | 1.234, -1,001.01e8 |
|
||||
| minLen(value) | `:username<minLen(4)\>` | Test (must be at least 4 characters) |
|
||||
| maxLen(value) | `:filename<maxLen(8)\>` | MyFile (must be no more than 8 characters |
|
||||
| len(length) | `:filename<len(12)\>` | somefile.txt (exactly 12 characters) |
|
||||
| min(value) | `:age<min(18)\>` | 19 (Integer value must be at least 18) |
|
||||
| max(value) | `:age<max(120)\>` | 91 (Integer value must be no more than 120) |
|
||||
| range(min,max) | `:age<range(18,120)\>` | 91 (Integer value must be at least 18 but no more than 120) |
|
||||
| alpha | `:name<alpha\>` | Rick (String must consist of one or more alphabetical characters, a-z and case-insensitive) |
|
||||
| datetime | `:dob<datetime(2006\\\\-01\\\\-02)\>` | 2005-11-01 |
|
||||
| regex(expression) | `:date<regex(\\d{4}-\\d{2}-\\d{2})\>` | 2022-08-27 (Must match regular expression) |
|
||||
|
||||
**Examples**
|
||||
|
||||
|
|
Loading…
Reference in New Issue