Conversation
|
pkg/lib/config/environment.go
Outdated
| // LogLevel sets the global log level | ||
| LogLevel string `envconfig:"LOG_LEVEL" default:"warn"` | ||
| // Log configures the logging | ||
| Log LogEnvironmentConfig `envconfig:"LOG"` |
There was a problem hiding this comment.
The logger read the environment variable separately. It seems nowhere is referencing it, should we remove it to avoid confusion.
There was a problem hiding this comment.
I want to have a centralized place for all environment variables, therefore I still define it here, so we can know what environment variables exist by looking at just one package.
There was a problem hiding this comment.
Finally I removed this field, because I found it difficult to ensure the LOG prefix is always used to load the config.
I also moved the struct to api package to solve import cycles.
pkg/util/otelutil/setup.go
Outdated
|
|
||
| shutdownFuncs = append(shutdownFuncs, traceProvider.Shutdown) | ||
|
|
||
| otlpEndpoint := os.Getenv("LOG_HANDLER_OTLP_ENDPOINT") |
There was a problem hiding this comment.
The environment variable is defined in LogEnvironmentConfig, so it’s better to use it there to process it. Otherwise, it may cause problems if we need to update the name in the future.
There was a problem hiding this comment.
The reason I put it here is because importing slogutil here will cause import cycle.
Maybe I should move the environment config struct to another independent package.
| logcli query --addr="http://localhost:3102" \ | ||
| '{service_name="authgear"} | app="YOUR_APP"' \ | ||
| --since=1h \ | ||
| -o jsonl -q |
Because it was setup in root authgear command



ref DEV-3341
ref DEV-3345