replaceablewriter

package module
v0.0.0-...-05c5f8e Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2019 License: MIT Imports: 2 Imported by: 1

README

replaceablewriter

Build Status Coverage Status MIT License GoDoc

replaceablewriter replace internal io.Writer

Synopsis

f, _ := os.Open("...")
w := replaceablewriter.New(f)
defer w.Close()
w.Write(...)

// replace
f2, _ := os.Open("...")
w.Replace(f2)
w.Write(...)

Description

replaceablewriter is a library that keeps io.Wrter inside, provides io.WriteCloser interface, and allows us to replace internal io.Writer safely.

It is useful for log rotation, etc.

Installation

% go get github.com/Songmu/replaceablewriter

Author

Songmu

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

func New

func New(w io.Writer) *Writer

New returns new replaceablewriter

func (*Writer) Close

func (w *Writer) Close() error

Close implements io.Closer

func (*Writer) Replace

func (w *Writer) Replace(wtr io.Writer)

Replace internal io.Writer

func (*Writer) Write

func (w *Writer) Write(b []byte) (int, error)

Write implements io.Writer

Jump to

Keyboard shortcuts

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