package tee

import "git.wntrmute.dev/kyle/goutils/tee"

Index

Functions

func Close

func Close() error

Close calls close on the global tee instance.

func Open

func Open(logFile string) error

Open will attempt to open the logFile for the global tee instance.

func Printf

func Printf(format string, args ...interface{}) (int, error)

Printf formats according to a format specifier and writes to the global tee.

func SetVerbose

func SetVerbose(verbose bool)

SetVerbose controls the verbosity of the global tee.

func VPrintf

func VPrintf(format string, args ...interface{}) (int, error)

VPrintf calls VPrintf on the global tee instance.

Types

type Tee

type Tee struct {
	Verbose bool
	// contains filtered or unexported fields
}

Tee emulates the Unix tee(1) command.

func NewOut

func NewOut(logFile string) (*Tee, error)

NewOut writes to standard output only. The file is created, not appended to.

func (*Tee) Close

func (t *Tee) Close() error

Close calls Close on the underlying file.

func (*Tee) Printf

func (t *Tee) Printf(format string, args ...interface{}) (int, error)

Printf formats according to a format specifier and writes to the tee instance.

func (*Tee) VPrintf

func (t *Tee) VPrintf(format string, args ...interface{}) (int, error)

VPrintf is a variant of Printf that only prints if the Tee's Verbose flag is set.

func (*Tee) Write

func (t *Tee) Write(p []byte) (int, error)

type WriteStringCloser

type WriteStringCloser interface {
	Write([]byte) (int, error)
	WriteString(string) (int, error)
	Close() error
}

Source Files

tee.go

Version
v1.7.7 (latest)
Published
Jun 15, 2024
Platform
linux/amd64
Imports
2 packages
Last checked
4 days ago

Tools for package owners.