util

package
v0.0.0-...-989fa2c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 26, 2023 License: Apache-2.0, MIT Imports: 11 Imported by: 0

Documentation

Overview

Package util groups a bunch of common helper functions used by commands.

Index

Constants

This section is empty.

Variables

View Source
var ErrorLogger io.Writer

ErrorLogger is where error messages should be written to. These messages are consumed by containerd and show up to users of command line tools, like docker/kubectl.

Functions

func EnumerateHostTPUDevices

func EnumerateHostTPUDevices() ([]uint32, error)

EnumerateHostTPUDevices returns the accelerator device minor numbers of all TPUs on the machine.

func Errorf

func Errorf(format string, args ...any) subcommands.ExitStatus

Errorf logs error to containerd log (--log), to stderr, and debug logs. It returns subcommands.ExitFailure for convenience with subcommand.Execute() methods:

return Errorf("Danger! Danger!")

func Fatalf

func Fatalf(format string, args ...any)

Fatalf logs the same way as Errorf() does, plus *exits* the process.

func Infof

func Infof(format string, args ...any)

Infof writes message to log and stdout.

Types

type Writer

type Writer struct{}

Writer writes to log and stdout.

func (*Writer) Write

func (i *Writer) Write(data []byte) (n int, err error)

Write implements io.Writer.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL