Skip to content

Package prefixwriter provides a writer that prefixes each line with a specified byte slice.

License

Notifications You must be signed in to change notification settings

goaux/prefixwriter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

prefixwriter

Package prefixwriter provides a writer that prefixes each line with a specified byte slice.

Go Reference Go Report Card

Features

  • Adds a specified prefix to the beginning of each line
  • Implements the io.Writer interface
  • Customizable buffer size
  • Tracks total bytes written

Usage

package main

import (
	"fmt"
	"os"

	"github.com/goaux/prefixwriter"
)

func main() {
	w := prefixwriter.New(os.Stdout, []byte("LOG: "))
	fmt.Fprintln(w, "This is a log message")
	fmt.Fprintln(w, "Another log message")
}

OUTPUT:

LOG: This is a log message
LOG: Another log message

About

Package prefixwriter provides a writer that prefixes each line with a specified byte slice.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages