timestamper

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package timestamper provides an io.Writer that adds timestamps at the beginning of each line of output.

Index

Constants

View Source
const DefaultFormat = "01/02/06 15:04:05.000"

DefaultFormat for the date and time prepended to each line of a TimeWriter.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

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

Writer is an io.Writer preceding each line in the output with the current time and date. See also time.Format.

func New

func New(w io.Writer) *Writer

New returns a new Writer object that time stamps each line of output and uses the default date and time format "01/02/06 15:04:05.999". See also time.Format.

func NewWithFormat

func NewWithFormat(w io.Writer, format string) *Writer

NewWithFormat returns a new Writer object hat time stamps each line of output and uses the specified date and time format.

func (*Writer) Write

func (t *Writer) Write(p []byte) (int, error)

Write writes len(p) bytes from p to the underlying data stream, preceding each line (separated by '\n') with the current time and date.

Jump to

Keyboard shortcuts

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