Skip to content

coalaura/plain

Repository files navigation

plain

A tiny logger for Go with a couple of handy input helpers.

Install

go get -u github.com/coalaura/plain

Quick start

import (
	"os"
	"github.com/coalaura/plain"
)

func main() {
	pl := plain.New(plain.WithDate(plain.RFC3339Local))

	pl.Println("Hello from Print")
	pl.Warnln("Hello from Warn")
	pl.Errorln("Hello from Error")

	input, err := pl.Read(os.Stdin, "Input: ", 64)
	pl.MustFail(err)

	pl.Printf("You entered '%s'\n", input)

	options := []string{"Red", "Green", "Blue", "Yellow"}

	idx, err := pl.Select("Select: ", options)
	pl.MustFail(err)

	pl.Printf("You selected '%s'\n", options[idx])
}

About

A very simple, minimal logger written in go.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages