unix

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: 6 Imported by: 0

Documentation

Overview

Package unix implements a unix domain socket writer which implements the Writer.

The unix domain socket writer aims at log watching. For log transmission, use a syslog writer instead. With a unix domain 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.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Pathname is the pathname of the socket file that will be created.
	// Shell expansion is NOT supported.
	// If Pathname is not specified, "/tmp/gxlog/<pid>" is used.
	Pathname string
	// Perm is permission of the socket file that will be created.
	// If Perm is not specified, 0700 is used.
	Perm os.FileMode
	// NoOverwrite specifies NOT to overwrite a existing socket file.
	NoOverwrite bool
}

A Config is used to configure a unix domain 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 unix domain sockets.

Jump to

Keyboard shortcuts

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