dnote/log/log.go
Sung Won Cho d31b22aed0
Improve output and edit command (#52)
* Refine output

* Show note content while editing

* v0.2.0-alpha.2
2018-01-07 18:18:47 +11:00

39 lines
909 B
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package log
import (
"fmt"
)
var (
ColorRed = 31
ColorGreen = 32
ColorYellow = 33
ColorBlue = 34
ColorGray = 37
)
var indent = " "
func Info(msg string) {
fmt.Printf("%s\033[%dm%s\033[0m %s\n", indent, ColorBlue, "•", msg)
}
func Infof(msg string, v ...interface{}) {
fmt.Printf("%s\033[%dm%s\033[0m %s", indent, ColorBlue, "•", fmt.Sprintf(msg, v...))
}
func Warnf(msg string, v ...interface{}) {
fmt.Printf("%s\033[%dm%s\033[0m %s", indent, ColorRed, "•", fmt.Sprintf(msg, v...))
}
func Error(msg string) {
fmt.Printf("%s\033[%dm%s\033[0m %s\n", indent, ColorRed, "", msg)
}
func Printf(msg string, v ...interface{}) {
fmt.Printf("%s\033[%dm%s\033[0m %s", indent, ColorGray, "•", fmt.Sprintf(msg, v...))
}
func WithPrefixf(prefixColor int, prefix, msg string, v ...interface{}) {
fmt.Printf(" \033[%dm%s\033[0m %s\n", prefixColor, prefix, fmt.Sprintf(msg, v...))
}