internal

package
v0.0.0-...-ad9cfc3 Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrNoRecords = Error("no_records")
	ErrClosed    = Error("closed")
)

Variables

View Source
var (
	Yellow = Color{
			// contains filtered or unexported fields
	}
	Green = Color{
			// contains filtered or unexported fields
	}
	Red = Color{
		// contains filtered or unexported fields
	}
	Brown = Color{
			// contains filtered or unexported fields
	}
)

Functions

func HandleLogLine

func HandleLogLine(conf *Config, l string)

func NewLogsController

func NewLogsController(svc LogsService) *logsController

func RequestIDMiddleware

func RequestIDMiddleware(next http.Handler) http.Handler

func ResponseTimeMiddleware

func ResponseTimeMiddleware(next http.Handler) http.Handler

func RunInBatches

func RunInBatches(ctx context.Context, batchSize, min, max int, fn func(ctx context.Context, start, end int) error) error

todo-rahul: tests.

Types

type Color

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

func (Color) HexCode

func (c Color) HexCode() string

func (Color) RGBA

func (c Color) RGBA() color.RGBA

type Config

type Config struct {
	Port       int
	FileToTail string           `yaml:"file_to_tail"`
	ParseKeys  []string         `yaml:"parse_keys"`
	LogLevels  map[string]level `yaml:"log_levels"`
}

func (Config) String

func (c Config) String() string

type Error

type Error string

func (Error) Error

func (e Error) Error() string

type LogsService

type LogsService interface {
	GetLogs(context.Context, int) ([]string, error)
	Shutdown(context.Context) error
}

func NewLogsService

func NewLogsService(file string) (LogsService, error)

NewLogsService returns an instance of LogsService. Should ideally call this with deferred LogsService.Shutdown to properly close resources.

Jump to

Keyboard shortcuts

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