mirror of
https://github.com/dnote/dnote
synced 2026-03-14 22:45:50 +01:00
* Open text editor for add and edit * Remove unused test * Improve output * Remove support for current book * Improve ls output and add an alias * Simplify logic * v0.2.0-alpha.3 * Add migration for editor * Add ASCII art
55 lines
1.3 KiB
Go
55 lines
1.3 KiB
Go
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 Success(msg string) {
|
||
fmt.Printf("%s\033[%dm%s\033[0m %s", indent, ColorGreen, "✔", msg)
|
||
}
|
||
|
||
func Successf(msg string, v ...interface{}) {
|
||
fmt.Printf("%s\033[%dm%s\033[0m %s", indent, ColorGreen, "✔", fmt.Sprintf(msg, v...))
|
||
}
|
||
|
||
func Plain(msg string) {
|
||
fmt.Printf("%s%s", indent, msg)
|
||
}
|
||
|
||
func Plainf(msg string, v ...interface{}) {
|
||
fmt.Printf("%s%s", indent, 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...))
|
||
}
|