log

package
v1.0.0-rc.6 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LevelTrace = Level(codersdk.LogLevelTrace)
	LevelDebug = Level(codersdk.LogLevelDebug)
	LevelInfo  = Level(codersdk.LogLevelInfo)
	LevelWarn  = Level(codersdk.LogLevelWarn)
	LevelError = Level(codersdk.LogLevelError)
)

Below constants are the same as their codersdk equivalents.

Variables

This section is empty.

Functions

func Writer

func Writer(logf Func) (io.Writer, func())

Writer returns an io.Writer that logs all writes in a separate goroutine. It is the responsibility of the caller to call the returned function to stop the goroutine.

Types

type Func

type Func func(l Level, msg string, args ...any)

func Coder

func Coder(ctx context.Context, coderURL *url.URL, token string) (Func, func(), error)

Coder establishes a connection to the Coder instance located at coderURL and authenticates using token. It then establishes a dRPC connection to the Agent API and begins sending logs. If the version of Coder does not support the Agent API, it will fall back to using the PatchLogs endpoint. The returned function is used to block until all logs are sent.

func New

func New(w io.Writer, verbose bool) Func

New logs to the provided io.Writer.

func Wrap

func Wrap(fs ...Func) Func

Wrap wraps the provided LogFuncs into a single Func.

type Level

type Level string

Jump to

Keyboard shortcuts

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