MCPcopy Create free account
hub / github.com/containerd/containerd / setGLogLevel

Function setGLogLevel

plugins/cri/runtime/plugin.go:177–202  ·  view source on GitHub ↗

Set glog level. TODO: mikebrow remove this klog inititialization func once we are no longer vendoring k8s.io/klog

()

Source from the content-addressed store, hash-verified

175// Set glog level.
176// TODO: mikebrow remove this klog inititialization func once we are no longer vendoring k8s.io/klog
177func setGLogLevel() error {
178 l := log.GetLevel()
179 fs := flag.NewFlagSet("klog", flag.PanicOnError)
180 klog.InitFlags(fs)
181 // Opt into fixed stderrthreshold behavior (kubernetes/klog#212).
182 if err := fs.Set("legacy_stderr_threshold_behavior", "false"); err != nil {
183 return err
184 }
185 if err := fs.Set("stderrthreshold", "INFO"); err != nil {
186 return err
187 }
188 if err := fs.Set("logtostderr", "true"); err != nil {
189 return err
190 }
191 switch l {
192 case log.TraceLevel:
193 return fs.Set("v", "5")
194 case log.DebugLevel:
195 return fs.Set("v", "4")
196 case log.InfoLevel:
197 return fs.Set("v", "2")
198 default:
199 // glog doesn't support other filters. Defaults to v=0.
200 }
201 return nil
202}
203
204func configMigration(ctx context.Context, configVersion int, pluginConfigs map[string]any) error {
205 if configVersion >= version.ConfigVersion {

Callers 1

initCRIRuntimeFunction · 0.85

Calls 1

SetMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…