xxxxxxxxxx
package main
import (
"log"
"log/slog"
"os"
"training/store"
)
func main() {
logger := slog.New(slog.NewJSONHandler(os.Stderr, nil))
logger.Info("hello gophers")
logger.Warn("be warned!")
logger.Error("this is broken")
// Set the logger for the application
slog.SetDefault(logger)
s := store.New()
// we can now use the standard logger again as it uses the options we set above
slog.Info("new store created", "store-id", s.ID)
// the standard logger now uses the new logger as well
log.Println("I'm log.println, look at me!")
}