https://signoz.io/guides/zap-logger/
package main
import (
"go.uber.org/zap"
)
func main() {
// Create a logger
logger, _ := zap.NewProduction()
defer logger.Sync() // Flushes buffer, if any
// Log some simple messages
logger.Info("This is an info message")
}
defer logger.Sync() ensures that any buffered log entries are flushed before the program exits.
No comments:
Post a Comment