Skip to content

Commit

Permalink
Update log.md
Browse files Browse the repository at this point in the history
  • Loading branch information
gaby authored Jul 3, 2024
1 parent 11bc5c2 commit fd7f315
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/api/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sidebar_position: 6

Logs serve as an essential tool for observing program behavior, diagnosing issues, and setting up corresponding alerts. Well-structured logs can significantly enhance search efficiency and streamline the troubleshooting process.

Fiber offers a default mechanism for logging to standard output. Additionally, it provides several global functions, including log.Info, log.Errorf, log.Warnw, among others, to facilitate comprehensive logging capabilities.
Fiber offers a default mechanism for logging to standard output. Additionally, it provides several global functions, including `log.Info`, `log.Errorf`, `log.Warnw`, among others, to facilitate comprehensive logging capabilities.

## Log levels

Expand Down Expand Up @@ -45,7 +45,7 @@ type AllLogger interface {
Note: The Fatal level method will terminate the program after printing the log message. Please use it with caution.

### Basic Logging
Logs of different levels can be directly printed. These will be entered into messageKey, with the default key being msg.
Logs of different levels can be directly printed. These will be entered into `messageKey`, with the default key being `msg`.

```go
log.Info("Hello, World!")
Expand All @@ -69,7 +69,7 @@ log.Fatalf("So Long, and Thanks for All the %s.", "banana")
```

### Key-Value Logging
Print a message with key-value pairs. If the key and value are not paired correctly, the log will output ` KEYVALS UNPAIRED`.
Print a message with key-value pairs. If the key and value are not paired correctly, the log will output `KEYVALS UNPAIRED`.

```go
log.Debugw("", "Hello", "boy")
Expand Down Expand Up @@ -173,4 +173,4 @@ commonLogger := log.WithContext(ctx)
commonLogger.Info("info")
```

Binding the logger to a context allows you to include context-specific information in your logs, improving traceability and debugging.
Binding the logger to a context allows you to include context-specific information in your logs, improving traceability and debugging.

0 comments on commit fd7f315

Please sign in to comment.