writer

package
v1.1.73 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 12 Imported by: 17 modules, 10 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var NewLine string

Functions

This section is empty.

Types

type CLI

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

CLI is a concurrent output writer to terminal.

func NewCLI

func NewCLI() *CLI

NewCLI returns a new CLI concurrent log writer.

func (*CLI) Write

func (w *CLI) Write(data []byte, level levels.Level)

WriteString writes an output to the underlying file

type Compression added in v1.1.71

type Compression interface {
	// Extension returns the file extension for the compressed file (e.g. ".gz").
	Extension() string
	// OpenWriter wraps w with a compressing writer.
	OpenWriter(w io.Writer) (io.WriteCloser, error)
}

Compression is the minimal interface used to compress rotated log files. It is intentionally small (only what gologger needs) so the package does not depend on a full multi-format archive library for what is effectively gzip.

type FileWithRotation added in v1.1.5

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

FileWithRotation is a concurrent output writer to a file with rotation.

func NewFileWithRotation added in v1.1.5

func NewFileWithRotation(options *FileWithRotationOptions) (*FileWithRotation, error)

NewFileWithRotation returns a new file concurrent log writer.

func (*FileWithRotation) Close added in v1.1.5

func (w *FileWithRotation) Close()

Close and flushes the logger

func (*FileWithRotation) CreateFile added in v1.1.5

func (w *FileWithRotation) CreateFile(filename string) (*os.File, error)

func (*FileWithRotation) Write added in v1.1.5

func (w *FileWithRotation) Write(data []byte, level levels.Level)

Write writes an output to the underlying file

type FileWithRotationOptions added in v1.1.5

type FileWithRotationOptions struct {
	Location string
	Rotate   bool

	RotationInterval time.Duration
	FileName         string
	Compress         bool
	MaxSize          int
	BackupTimeFormat string
	ArchiveFormat    Compression
	// Helpers
	RotateEachHour bool
	RotateEachDay  bool
	// contains filtered or unexported fields
}
var DefaultFileWithRotationOptions FileWithRotationOptions

type GzipCompression added in v1.1.71

type GzipCompression struct{}

GzipCompression compresses rotated logs using the standard library compress/gzip.

func (GzipCompression) Extension added in v1.1.71

func (GzipCompression) Extension() string

Extension returns the gzip file extension.

func (GzipCompression) OpenWriter added in v1.1.71

func (GzipCompression) OpenWriter(w io.Writer) (io.WriteCloser, error)

OpenWriter returns a gzip writer wrapping w.

type Writer

type Writer interface {
	// Write writes the data to an output writer.
	Write(data []byte, level levels.Level)
}

Writer type writes data to an output type.

Jump to

Keyboard shortcuts

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