logs

package
v0.52.1 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2025 License: Apache-2.0 Imports: 15 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogDelimiter = "!-#_^*|\n"

Functions

func ReadCompressedFile added in v0.52.0

func ReadCompressedFile(filePath string) (io.Reader, error)

func ReadJSONLog added in v0.52.0

func ReadJSONLog(ctx context.Context, logReader io.Reader, follow bool, c chan interface{}, errChan chan error)

func ReadLog added in v0.52.0

func ReadLog(ctx context.Context, logReader io.Reader, follow bool, c chan []byte, errChan chan error)

Types

type ApiBasePath added in v0.52.0

type ApiBasePath string
var (
	ApiBasePathWorkspace ApiBasePath = "/log/workspace"
	ApiBasePathBuild     ApiBasePath = "/log/build"
	ApiBasePathRunner    ApiBasePath = "/log/runner"
	ApiBasePathTarget    ApiBasePath = "/log/target"
)

type ILoggerFactory added in v0.52.0

type ILoggerFactory interface {
	CreateLogger(id, label string, source LogSource) (Logger, error)
	CreateLogReader(id string) (io.Reader, error)
	CreateLogWriter(id string) (io.WriteCloser, error)
}

func NewLoggerFactory

func NewLoggerFactory(config LoggerFactoryConfig) ILoggerFactory

type LogEntry

type LogEntry struct {
	Source string `json:"source"`
	Label  string `json:"label"`
	Msg    string `json:"msg"`
	Level  string `json:"level"`
	Time   string `json:"time"`
}

type LogFileConfig added in v0.52.0

type LogFileConfig struct {
	Path       string `json:"path" validate:"required"`
	MaxSize    int32  `json:"maxSize" validate:"required"`
	MaxBackups int32  `json:"maxBackups" validate:"required"`
	MaxAge     int32  `json:"maxAge" validate:"required"`
	LocalTime  bool   `json:"localTime" validate:"optional"`
	Compress   bool   `json:"compress" validate:"optional"`

} // @name LogFileConfig

func GetDefaultLogFileConfig added in v0.52.0

func GetDefaultLogFileConfig(logFilePath string) *LogFileConfig

type LogSource

type LogSource string
const (
	LogSourceServer   LogSource = "server"
	LogSourceProvider LogSource = "provider"
	LogSourceBuilder  LogSource = "builder"
	LogSourceRunner   LogSource = "runner"
)

type Logger

type Logger interface {
	io.WriteCloser
	ConstructJsonLogEntry(p []byte) ([]byte, error)
	Cleanup() error
}

type LoggerFactoryConfig added in v0.52.0

type LoggerFactoryConfig struct {
	LogsDir     string
	ApiUrl      *string
	ApiKey      *string
	ApiBasePath *ApiBasePath
}

type RemoteLogger added in v0.52.0

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

func (*RemoteLogger) Cleanup added in v0.52.0

func (r *RemoteLogger) Cleanup() error

func (*RemoteLogger) Close added in v0.52.0

func (r *RemoteLogger) Close() error

func (*RemoteLogger) ConstructJsonLogEntry added in v0.52.0

func (r *RemoteLogger) ConstructJsonLogEntry(p []byte) ([]byte, error)

func (*RemoteLogger) Write added in v0.52.0

func (r *RemoteLogger) Write(p []byte) (n int, err error)

type RemoteLoggerFactoryConfig added in v0.52.0

type RemoteLoggerFactoryConfig struct {
	LogsDir     string
	ApiUrl      string
	ApiKey      string
	ApiBasePath ApiBasePath
}

Jump to

Keyboard shortcuts

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