output

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2022 License: MIT Imports: 18 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ElasticSearchConfig added in v1.6.2

type ElasticSearchConfig = elasticsearch.Config

ElasticSearchConfig is the ElasticSearch configuration.

type IOutput

type IOutput interface {
	meta.IMeta

	// String interface.
	String() string

	// GetBuiltinLogger returns the Golang's builtin logger.
	GetBuiltinLogger() *builtin.Builtin

	// SetBuiltinLogger sets the Golang's builtin logger.
	SetBuiltinLogger(builtinLogger *builtin.Builtin) IOutput

	// GetFormatter returns the formatter.
	GetFormatter() formatter.IFormatter

	// SetFormatter sets the formatter.
	SetFormatter(fmtr formatter.IFormatter) IOutput

	// GetMaxLevel returns the max level.
	GetMaxLevel() level.Level

	// SetMaxLevel sets the max level.
	SetMaxLevel(l level.Level) IOutput

	// AddProcessors adds one or more processors.
	AddProcessors(processors ...processor.IProcessor) IOutput

	// GetProcessor returns the registered processor by its name. If not found, will be nil.
	GetProcessor(name string) processor.IProcessor

	// SetProcessors sets one or more processors.
	SetProcessors(processors ...processor.IProcessor) IOutput

	// GetProcessors returns registered processors.
	GetProcessors() []processor.IProcessor

	// GetProcessorsNames returns the names of the registered processors.
	GetProcessorsNames() []string

	// GetWriter returns the writer.
	GetWriter() io.Writer

	// SetWriter sets the writer.
	SetWriter(w io.Writer) IOutput

	// Write write the message to the defined output.
	Write(m message.IMessage) error
}

IOutput specifies what an output does.

func Console

func Console(maxLevel level.Level, processors ...processor.IProcessor) IOutput

Console is a built-in `output` - named `Console`, that writes to `stdout`.

func ElasticSearch added in v1.6.2

func ElasticSearch(
	indexName string,
	esConfig ElasticSearchConfig,
	maxLevel level.Level,
	processors ...processor.IProcessor,
) IOutput

ElasticSearch is a built-in `output` - named `ElasticSearch`, that writes to ElasticSearch.

NOTE: By default, data is JSON-formatted. NOTE: `DocumentID` is automatically generated.

func File

func File(path string, maxLevel level.Level, processors ...processor.IProcessor) IOutput

File is a built-in `output` - named `File`, that writes to the specified file.

Note: If the common used "-" is used, it will behave as a Console writing to stdout.

func FileBased

func FileBased(
	name string,
	maxLevel level.Level,
	writer io.Writer,
	processors ...processor.IProcessor,
) IOutput

FileBased is a built-in `output`, that writes to the specified file.

func New

func New(name string,
	maxLevel level.Level,
	w io.Writer,
	processors ...processor.IProcessor,
) IOutput

New is the Output factory.

func SafeBuffer

func SafeBuffer(maxLevel level.Level, processors ...processor.IProcessor) (*safebuffer.Buffer, IOutput)

SafeBuffer is a built-in `output` - named `Buffer`, that writes to the buffer.

func StdErr

func StdErr(processors ...processor.IProcessor) IOutput

StdErr is a built-in `output` - named `StdErr`, that only writes to `stderr` message @ Error level.

Jump to

Keyboard shortcuts

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