buildlog

package
v0.0.0-...-ed4baf8 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

Package startuplog contains logic for writing logs related to startup of the workspace.

Index

Constants

View Source
const (
	// To avoid excessive DB calls we batch our output.
	// We'll keep at most 20KB of output in memory at a given time.
	CoderLoggerMaxLogs = 20
	MaxCoderLogSize    = 1 << 10
)
View Source
const (
	JSONLogTypeDone  = "done"
	JSONLogTypeInfo  = "info"
	JSONLogTypeError = "error"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CoderClient

type CoderClient interface {
	Send(level codersdk.LogLevel, log string) error
	io.Closer
}

func OpenCoderClient

func OpenCoderClient(ctx context.Context, logger slog.Logger, accessURL *url.URL, hc *http.Client, token string) (CoderClient, error)

type CoderLogger

type CoderLogger struct {
	// contains filtered or unexported fields
}

func (*CoderLogger) Close

func (c *CoderLogger) Close() error

func (*CoderLogger) Error

func (c *CoderLogger) Error(output string)

func (*CoderLogger) Errorf

func (c *CoderLogger) Errorf(format string, a ...any)

func (*CoderLogger) Info

func (c *CoderLogger) Info(output string)

func (*CoderLogger) Infof

func (c *CoderLogger) Infof(format string, a ...any)

func (*CoderLogger) Write

func (c *CoderLogger) Write(p []byte) (int, error)

type JSONLog

type JSONLog struct {
	Output string    `json:"output"`
	Time   time.Time `json:"time"`
	Type   string    `json:"type"`
}

type JSONLogger

type JSONLogger struct {
	Encoder *json.Encoder
}

func (JSONLogger) Close

func (j JSONLogger) Close() error

func (JSONLogger) Error

func (j JSONLogger) Error(output string)

func (JSONLogger) Errorf

func (j JSONLogger) Errorf(format string, a ...any)

func (JSONLogger) Info

func (j JSONLogger) Info(output string)

func (JSONLogger) Infof

func (j JSONLogger) Infof(format string, a ...any)

func (JSONLogger) Write

func (j JSONLogger) Write(p []byte) (int, error)

type Logger

type Logger interface {
	Info(output string)
	Infof(format string, a ...any)
	Error(output string)
	Errorf(format string, a ...any)
	Close() error
	io.Writer
}

func MultiLogger

func MultiLogger(loggers ...Logger) Logger

func OpenCoderLogger

func OpenCoderLogger(ctx context.Context, client CoderClient, log slog.Logger) Logger

type NopLogger

type NopLogger struct{}

func (NopLogger) Close

func (NopLogger) Close() error

func (NopLogger) Error

func (NopLogger) Error(string)

func (NopLogger) Errorf

func (NopLogger) Errorf(string, ...any)

func (NopLogger) Info

func (NopLogger) Info(string)

func (NopLogger) Infof

func (NopLogger) Infof(string, ...any)

func (NopLogger) Write

func (NopLogger) Write([]byte) (int, error)

type StartupLog

type StartupLog struct {
	CreatedAt time.Time `json:"created_at"`
	Output    string    `json:"output"`
}

Jump to

Keyboard shortcuts

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