:art: Contextual fmt inspired by bootstrap color classes
Contextual fmt
It provides contextual formatting functions that have nearly identical usage of the fmt package. The ideas were borrowed from bootstrap's contextual color classes.
go get github.com/mingrammer/cfmt
package main
import (
"log"
"github.com/mingrammer/cfmt"
)
func main() {
cfmt.Success("User was created successfully")
cfmt.Infoln("Here are some candidates")
cfmt.Warningf("%s is not valid integer value\n", "123a")
log.Fatal(cfmt.Serrorf("Only numeric is allowed, got %s", "123.456a"))
}
Note: cfmt.Errorf function does not do same things to fmt.Errorf, but to fmt.Printf with red colored text.
MIT