Skip to content

Commit

Permalink
add error logging to ansi package
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-caldwell committed Nov 21, 2024
1 parent 94e85c5 commit a45dac3
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package ansi

// Error - print error message
func Error(msg ...interface{}) *Color {
return (&Color{}).Error(msg...)
}

// Errorf - print error message
func Errorf(format string, msg ...interface{}) *Color {
return (&Color{}).Errorf(format, msg...)
}

// Errorln - print error message
func Errorln(msg ...interface{}) *Color {
return (&Color{}).Errorln(msg...)
}

// Error - print error message
func (c *Color) Error(msg ...interface{}) *Color {
c.Red().Print("[ERROR]: ")
for _, m := range msg {
c.Print(m.(string))
}
return c
}

// Errorf - print error message
func (c *Color) Errorf(format string, msg ...interface{}) *Color {
return Red().Printf("[ERROR]: "+format, msg...)
}

// Errorln - print error message
func (c *Color) Errorln(msg ...interface{}) *Color {
return c.Errorln(msg...).LF()
}

0 comments on commit a45dac3

Please sign in to comment.