mirror of
https://github.com/lukaszraczylo/go-simple-graphql.git
synced 2026-10-12 00:45:31 +00:00
fixup! fixup! fixup! fixup! fixup! Library improvements.
This commit is contained in:
@@ -10,10 +10,29 @@ import (
|
||||
)
|
||||
|
||||
func NewConnection() (b *BaseClient) {
|
||||
// Read LOG_LEVEL environment variable
|
||||
logLevelStr := envutil.Getenv("LOG_LEVEL", "info")
|
||||
logLevel := logging.GetLogLevel(logLevelStr)
|
||||
|
||||
// Create logger and set the log level from environment
|
||||
logger := logging.New()
|
||||
logger.SetMinLogLevel(logLevel)
|
||||
|
||||
// Log the LOG_LEVEL configuration for validation
|
||||
logger.Info(&logging.LogMessage{
|
||||
Message: "Logger initialized with LOG_LEVEL configuration",
|
||||
Pairs: map[string]interface{}{
|
||||
"LOG_LEVEL_env_var": logLevelStr,
|
||||
"parsed_log_level": logLevel,
|
||||
"level_name": logging.LevelNames[logLevel],
|
||||
"default_min_level": logging.LEVEL_INFO,
|
||||
},
|
||||
})
|
||||
|
||||
b = &BaseClient{
|
||||
endpoint: envutil.Getenv("GRAPHQL_ENDPOINT", "https://api.github.com/graphql"),
|
||||
responseType: envutil.Getenv("GRAPHQL_OUTPUT", "string"),
|
||||
Logger: logging.New(),
|
||||
Logger: logger,
|
||||
cache: cache.New(time.Duration(envutil.GetInt("GRAPHQL_CACHE_TTL", 5)) * time.Second),
|
||||
cache_global: envutil.GetBool("GRAPHQL_CACHE_ENABLED", false),
|
||||
retries_enable: envutil.GetBool("GRAPHQL_RETRIES_ENABLE", false),
|
||||
@@ -25,7 +44,8 @@ func NewConnection() (b *BaseClient) {
|
||||
Message: "Created new GraphQL client connection",
|
||||
Pairs: map[string]interface{}{
|
||||
"values": b,
|
||||
}})
|
||||
},
|
||||
})
|
||||
return b
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user