Documentation ¶
Index ¶
- func Error(args ...any)
- func ErrorS(err error, msg string, keysAndValues ...any)
- func Get() api.Klog
- func Info(args ...any)
- func InfoS(msg string, keysAndValues ...any)
- func KObj(obj proto.Metadata) fmt.Stringer
- func KObjSlice[M proto.Metadata](objs []M) fmt.Stringer
- func KObjSliceFn[M proto.Metadata](lazy func() []M) fmt.Stringer
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Error ¶
func Error(args ...any)
Error is a convenience that calls the same method documented on api.Klog.
Note: See Info for unit test and benchmarking impact.
Example ¶
package main import ( "fmt" "sigs.k8s.io/kube-scheduler-wasm-extension/guest/klog" ) func main() { metricName := "scheduler_framework_extension_point_duration_milliseconds" err := fmt.Errorf("metric %q not found", metricName) klog.Error(err) }
Output:
func ErrorS ¶
ErrorS is a convenience that calls the same method documented on api.Klog.
Note: See Info for unit test and benchmarking impact.
Example ¶
package main import ( "fmt" "sigs.k8s.io/kube-scheduler-wasm-extension/guest/klog" ) func main() { bucketSize := 32 histBucketSize := 16 index := 2 err := fmt.Errorf("found different bucket size: expect %v, but got %v at index %v", bucketSize, histBucketSize, index) metricName := "scheduler_framework_extension_point_duration_milliseconds" labels := map[string]string{"Name": "some-name"} klog.ErrorS(err, "the validation for HistogramVec is failed. The data for this metric won't be stored in a benchmark result file", "metric", metricName, "labels", labels) }
Output:
func Get ¶
Get can be called at any time, to get a logger that writes to the WebAssembly host.
For example:
func main() { klog := klog.Get() klog.Info("hello", "world") }
func Info ¶
func Info(args ...any)
Info is a convenience that calls the same method documented on api.Klog.
Note: Code that uses can be unit tested in normal Go, but cannot be unit tested or benchmarked via `tinygo test -target=wasi`. To avoid this problem, use Get instead.
Example ¶
package main import ( "sigs.k8s.io/kube-scheduler-wasm-extension/guest/klog" ) func main() { klog.Info("NodeNumberArgs is successfully applied") }
Output:
func InfoS ¶
InfoS is a convenience that calls the same method documented on api.Klog.
Note: See Info for unit test and benchmarking impact.
Example ¶
package main import ( "sigs.k8s.io/kube-scheduler-wasm-extension/guest/api/proto" "sigs.k8s.io/kube-scheduler-wasm-extension/guest/klog" klogapi "sigs.k8s.io/kube-scheduler-wasm-extension/guest/klog/api" ) var pod proto.Pod func main() { klog.InfoS("execute Score on NodeNumber plugin", "pod", klogapi.KObj(pod)) }
Output:
func KObj ¶
KObj is a convenience that calls api.KObj. This is re-declared here for familiarity.
Note: See Info for unit test and benchmarking impact.
Types ¶
This section is empty.