reader

package
v0.0.0-...-38ecb19 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package reader is responsible for reading log line from different data sources

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConsoleReaderPrompt is the prompt for console reader
	//nolint:gochecknoglobals
	ConsoleReaderPrompt = " logtrics \033[31m>\033[0m "

	//ConsoleReaderHistory is the history file for console input lines
	//nolint:gochecknoglobals
	ConsoleReaderHistory = "/tmp/readline.tmp"

	// ConsoleReaderHelp is the help text to print on console reader startup
	//nolint:gochecknoglobals
	ConsoleReaderHelp = `` /* 214-byte string literal not displayed */

)

Functions

This section is empty.

Types

type Console

type Console struct {
	io.Writer
	io.Reader
	// contains filtered or unexported fields
}

Console represents the LogReader in console mode

func (*Console) Start

func (c *Console) Start(ctx context.Context, cb ReadCallBack) error

Start the reader in console mode

type LogEvent

type LogEvent struct {
	Source string
	Line   string
	Err    error
}

LogEvent is the event represents single log line read by the reader

type LogReader

type LogReader interface {
	Start(ctx context.Context, cb ReadCallBack) error
}

LogReader is the interface to read logs

func NewConsole

func NewConsole(conf *config.Configuration) (LogReader, error)

NewConsole returns a new Console runner instance

func NewTCP

func NewTCP(conf *config.Configuration) LogReader

NewUDP returns a new reader which reads the logs from the UDP socket

func NewUDP

func NewUDP(conf *config.Configuration) LogReader

NewUDP returns a new reader which reads the logs from the UDP socket

type ReadCallBack

type ReadCallBack = func(event LogEvent)

ReadCallBack is the callback function for log events

type TCP

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

UDP represents the log reader in UDP server mode

func (*TCP) Start

func (s *TCP) Start(ctx context.Context, cb ReadCallBack) error

Start starts the reader this is a blocking call

type UDP

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

UDP represents the log reader in UDP server mode

func (*UDP) Start

func (s *UDP) Start(ctx context.Context, cb ReadCallBack) error

Start starts the reader this is a blocking call

Jump to

Keyboard shortcuts

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