Skip to content

Commit

Permalink
Add log level configuration via environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
powerkimhub committed May 9, 2024
1 parent 75f73c0 commit 5c894f2
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions api-runtime/common-runtime/CommonManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ package commonruntime

import (
"fmt"
"os"
"strings"

"encoding/json"
Expand Down Expand Up @@ -126,6 +127,7 @@ func init() {
cblog = cblogger.GetLogger("CLOUD-BARISTA")
// logger for HisCall
callogger = call.GetLogger("HISCALL")
setLogLevel()
}

type AllResourceList struct {
Expand All @@ -136,6 +138,18 @@ type AllResourceList struct {
}
}

func setLogLevel() {
logLevel := strings.ToLower(os.Getenv("SPIDER_LOG_LEVEL"))
if logLevel != "" {
cblogger.SetLevel(logLevel)
}

callLogLevel := strings.ToLower(os.Getenv("SPIDER_HISCALL_LOG_LEVEL"))
if callLogLevel != "" {
call.SetLevel(callLogLevel)
}
}

func GetAllSPLockInfo() []string {
var results []string

Expand Down

0 comments on commit 5c894f2

Please sign in to comment.