Files
gotenberg/internal/pkg/notify/notify.go
Julien Neuhart 194670c3bf 5.0.0 (#66)
2019-04-14 17:07:45 +02:00

36 lines
771 B
Go

package notify
import (
"fmt"
"os"
"github.com/labstack/gommon/color"
)
// Print prints a message to stdout.
func Print(message string) {
stdout := color.New()
stdout.SetOutput(os.Stdout)
stdout.Printf("⇨ %s\n", message)
}
// Printf prints a formatted message to stdout.
func Printf(format string, a ...interface{}) {
message := fmt.Sprintf(format, a...)
Print(message)
}
// WarnPrint prints a warning to stderr.
func WarnPrint(err error) {
stderr := color.New()
stderr.SetOutput(os.Stderr)
stderr.Printf("%s\n", color.Yellow(fmt.Sprintf("⇨ warn: %v", err)))
}
// ErrPrint prints an error to stderr.
func ErrPrint(err error) {
stderr := color.New()
stderr.SetOutput(os.Stderr)
stderr.Printf("%s\n", color.Red(fmt.Sprintf("⇨ error: %v", err)))
}