config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2022 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Topic sets a namespace for messages.
	Topic string

	// NsqdURL is the URL to http service of an nsqd daemon.
	Address string

	// Regex -- when set, only lines corresponding the pattern are kept for
	// nsqd server. The settings do not influence STDERR output. If both
	// Regex and Contains are given, thir effect is additive (both of them
	// must match.
	Regex *regexp.Regexp

	// Contains -- when set, lines that contain (or not contain) the pattern
	// will be kept. The setting does not influence StderrLogs output.
	// If a pattern should not match, it has to start with '!'.
	//
	// "api" -- log must contain "api" pattern.
	// "!api" -- log must NOT contain "api" pattern.
	Contains string

	// StderrLogs enables printing of logs to STDERR. This output is not
	// filtered and contains all log lines.
	StderrLogs bool

	// Sends results of filtering to STDOUT.
	Debug bool
}

Config provides data necessary to start NSQ session. NSQ is a distributed messaging service.

func New

func New(opts ...Option) Config

New creates a new Config according to given options.

type Option

type Option func(*Config)

Option type allows to send options to Config

func OptAddress

func OptAddress(s string) Option

OptAddress sets the address to a TCP nsqd service (e.g. 127.0.0.1:4150).

func OptContains added in v0.1.0

func OptContains(s string) Option

OptContains sets the Contains field.

func OptDebug added in v0.1.0

func OptDebug(b bool) Option

OptDebug sets Debug field

func OptRegex

func OptRegex(s string) Option

OptRegex sets a regular expression for filtering logs.

func OptStderrLogs

func OptStderrLogs(b bool) Option

OptStderrLogs sets flag for printing logs to STDERR.

func OptTopic

func OptTopic(s string) Option

OptTopic sets NSQ's topic to send logs to.

Jump to

Keyboard shortcuts

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