Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( Stdout = NopWriter(os.Stdout) Stderr = NopWriter(os.Stderr) Discard = NopWriter(ioutil.Discard) )
Reopenable versions of os.Stdout, os.Stderr, /dev/null (reopen does nothing)
Functions ¶
This section is empty.
Types ¶
type BufferedFileWriter ¶
type BufferedFileWriter struct {
// contains filtered or unexported fields
}
BufferedFileWriter is buffer writer than can be reopned
func NewBufferedFileWriter ¶
func NewBufferedFileWriter(w *FileWriter) *BufferedFileWriter
NewBufferedFileWriter opens a buffered file that is periodically
flushed.
func NewBufferedFileWriterSize ¶
func NewBufferedFileWriterSize(w *FileWriter, size int, flush time.Duration) *BufferedFileWriter
NewBufferedFileWriterSize opens a buffered file with the given size that is periodically
flushed on the given interval.
func (*BufferedFileWriter) Close ¶
func (bw *BufferedFileWriter) Close() error
Close flushes the internal buffer and closes the destination file
func (*BufferedFileWriter) Reopen ¶
func (bw *BufferedFileWriter) Reopen() error
Reopen implement Reopener
type FileWriter ¶
type FileWriter struct {
// contains filtered or unexported fields
}
FileWriter that can also be reopened
func NewFileWriter ¶
func NewFileWriter(name string) (*FileWriter, error)
NewFileWriter opens a file for appending and writing and can be reopened. it is a ReopenWriteCloser...
func NewFileWriterMode ¶
func NewFileWriterMode(name string, mode os.FileMode) (*FileWriter, error)
NewFileWriterMode opens a Reopener file with a specific permission
func (*FileWriter) Close ¶
func (f *FileWriter) Close() error
Close calls the underlyding File.Close()
type Reopener ¶
type Reopener interface {
Reopen() error
}
Reopener interface defines something that can be reopened
type WriteCloser ¶
type WriteCloser interface { Reopener io.WriteCloser }
WriteCloser is a io.WriteCloser that can also be reopened
func NopWriter ¶
func NopWriter(w io.Writer) WriteCloser
NopWriter turns a normal writer into a ReopenWriter
by doing a NOP on Reopen. See https://en.wikipedia.org/wiki/NOP
type Writer ¶
Writer is a writer that also can be reopened
func MultiWriter ¶
MultiWriter creates a writer that duplicates its writes to all the provided writers, similar to the Unix tee(1) command.
Also allow reopen