Categorygithub.com/goaux/prefixwriter
repositorypackage
1.0.2
Repository: https://github.com/goaux/prefixwriter.git
Documentation: pkg.go.dev

# README

prefixwriter

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

Go Reference Go Report Card

[!IMPORTANT] Deprecated: Use github.com/goaux/decowriter instead

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