Skip to content

Commit

Permalink
simplify logger init (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixKuhnAnsys authored Sep 4, 2024
1 parent 633f339 commit 5c8425b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.22.0
toolchain go1.22.5

require (
github.com/ansys/allie-sharedtypes v0.0.0-20240902100814-0bdc50fadbec
github.com/ansys/allie-sharedtypes v0.0.0-20240904075127-5291d92348f7
github.com/google/go-github/v56 v56.0.0
github.com/google/uuid v1.6.0
github.com/pandodao/tokenizer-go v0.2.0
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ github.com/andybalholm/cascadia v1.3.2 h1:3Xi6Dw5lHF15JtdcmAHD3i1+T8plmv7BQ/nsVi
github.com/andybalholm/cascadia v1.3.2/go.mod h1:7gtRlve5FxPPgIgX36uWBX58OdBsSS6lUvCFb+h7KvU=
github.com/ansys/allie-sharedtypes v0.0.0-20240902100814-0bdc50fadbec h1:l2fkYSi8tU83QoCD/bgaVoOlOU09zMMhxSx5HPDDGJA=
github.com/ansys/allie-sharedtypes v0.0.0-20240902100814-0bdc50fadbec/go.mod h1:tp0CyD2VVrFzR6BzgcXAShhSGEcFWGr/+EMvyb1JJqM=
github.com/ansys/allie-sharedtypes v0.0.0-20240904075127-5291d92348f7 h1:gCamyW5nSvIyevlpuT/PHpY9yNcKTJWHJGmMOR+jD1g=
github.com/ansys/allie-sharedtypes v0.0.0-20240904075127-5291d92348f7/go.mod h1:tp0CyD2VVrFzR6BzgcXAShhSGEcFWGr/+EMvyb1JJqM=
github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk=
github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd30/FjWUq4=
github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4=
Expand Down
18 changes: 2 additions & 16 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var dataExtractionFile string
func init() {
// initialize config
config.InitConfig([]string{"EXTERNALFUNCTIONS_GRPC_PORT", "LLM_HANDLER_ENDPOINT"}, map[string]interface{}{
"SERVICE_NAME": "allie-flowkit",
"VERSION": "1.0",
"STAGE": "PROD",
"ERROR_FILE_LOCATION": "error.log",
Expand All @@ -29,22 +30,7 @@ func init() {
})

// initialize logging
logging.InitLogger()
logging.InitConfig(logging.Config{
ErrorFileLocation: config.GlobalConfig.ERROR_FILE_LOCATION,
LogLevel: config.GlobalConfig.LOG_LEVEL,
LocalLogs: config.GlobalConfig.LOCAL_LOGS,
LocalLogsLocation: config.GlobalConfig.LOCAL_LOGS_LOCATION,
DatadogLogs: config.GlobalConfig.DATADOG_LOGS,
DatadogSource: config.GlobalConfig.DATADOG_SOURCE,
DatadogStage: config.GlobalConfig.STAGE,
DatadogVersion: config.GlobalConfig.VERSION,
DatadogService: config.GlobalConfig.SERVICE_NAME,
DatadogAPIKey: config.GlobalConfig.LOGGING_API_KEY,
DatadogLogsURL: config.GlobalConfig.LOGGING_URL,
DatadogMetrics: config.GlobalConfig.DATADOG_METRICS,
DatadogMetricsURL: config.GlobalConfig.METRICS_URL,
})
logging.InitLogger(config.GlobalConfig)
}

func main() {
Expand Down

0 comments on commit 5c8425b

Please sign in to comment.