tcp

package
v1.0.100 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package tcp implements a tcp socket writer which implements the Writer.

The tcp socket writer aims at log watching. For log transmission, use a syslog writer instead. With a tcp socket writer, you can use 'netcat' to receive and watch logs rather than the 'tail' which is inconvenient because a new log file will be created when a log file reaches its max size.

For performance and security, use a unix writer instead as long as the system has support for unix domain socket. Otherwise, bind the address to localhost only.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// If Tag is not specified, "localhost:9999" is used.
	Addr string
}

A Config is used to configure a tcp socket writer.

type Writer

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

A Writer implements the interface iface.Writer.

All methods of a Writer are concurrency safe. A Writer MUST be created with Open.

func Open

func Open(config Config) (*Writer, error)

Open creates a new Writer with the config.

func (*Writer) Close

func (writer *Writer) Close() error

Close closes the Writer.

func (*Writer) Write

func (writer *Writer) Write(bs []byte, record *iface.Record)

Write implements the interface Writer. It writes logs to tcp sockets.

Jump to

Keyboard shortcuts

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