Skip to content

🤸‍♀️ A writer that writes to multiple other writers and the writers can be added and removed dynamically.

License

Notifications You must be signed in to change notification settings

alanshaw/multiwriter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

multiwriter

Build Status Coverage Standard README pkg.go.dev reference golang version Go Report Card

A writer that writes to multiple other writers and the writers can be added and removed dynamically.

Install

go get github.com/alanshaw/multiwriter

Usage

Example:

package main

import (
	"os"
	"github.com/alanshaw/multiwriter"
)

func main() {
	w := multiwriter.New(os.Stdout, os.Stderr)

	w.Write([]byte("written to stdout AND stderr\n"))

	w.Remove(os.Stderr)

	w.Write([]byte("written to ONLY stdout\n"))

	w.Remove(os.Stdout)
	w.Add(os.Stderr)

	w.Write([]byte("written to ONLY stderr\n"))
}

API

pkg.go.dev Reference

Contribute

Feel free to dive in! Open an issue or submit PRs.

License

MIT © Alan Shaw

About

🤸‍♀️ A writer that writes to multiple other writers and the writers can be added and removed dynamically.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages