infra: add logging wrapping
Resolves issues with gcp cloud logging quirks such as field names
This commit is contained in:
@@ -3,17 +3,19 @@ package internal
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"log/slog"
|
||||
"os"
|
||||
|
||||
"github.com/flowy-live/llink/internal/utils"
|
||||
"github.com/flowy-live/llink/internal/utils/flog"
|
||||
|
||||
"github.com/redis/go-redis/v9"
|
||||
|
||||
"github.com/flowy-live/llink/internal/utils"
|
||||
)
|
||||
|
||||
func ConnectAndTestRedis(db int) *redis.Client {
|
||||
redisHost := utils.MustGetEnv("REDIS_HOST")
|
||||
if redisHost == "" {
|
||||
slog.Error("must provide REDIS_HOST")
|
||||
flog.Error("must provide REDIS_HOST")
|
||||
os.Exit(1)
|
||||
}
|
||||
redisAddr := fmt.Sprintf("%s:%s", redisHost, "6379")
|
||||
@@ -32,7 +34,7 @@ func ConnectAndTestRedis(db int) *redis.Client {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
slog.Debug("redis test", "key", val)
|
||||
flog.Debug("redis test", "key", val)
|
||||
if val != "value" {
|
||||
panic("unexpected value")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user