Mode:
Duration:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package main
import (
"encoding/json"
"fmt"
"time"
)
type LogEntry struct {
Time string `json:"time"`
Level string `json:"level"`
RequestID string `json:"request_id"`
CorrelationID string `json:"correlation_id"`
Message string `json:"message"`
}
func main() {
entry := LogEntry{
Time: time.Now().Format(time.RFC3339),
Level: "INFO",
RequestID: "req-12345",
CorrelationID: "corr-67890",
Message: "User login successful",
}
log, _ := json.Marshal(entry)
fmt.Println(string(log))
}Coding works best on desktop or with an external keyboard.