11package logger
22
3+ import (
4+ "fmt"
5+ "os"
6+ )
7+
38type logger struct {}
49
510// Logger returns a new barf logger instance
@@ -12,22 +17,59 @@ func (l *logger) Info(msg string) {
1217 Info (msg )
1318}
1419
20+ // Infof logs a formatted message with the green color
21+ func (l * logger ) Infof (msg string , v ... interface {}) {
22+ Info (fmt .Sprintf (msg , v ... ))
23+ }
24+
1525// Error logs a message with the red color
1626func (l * logger ) Error (msg string ) {
1727 Error (msg )
1828}
1929
30+ // Errorf logs a formatted message with the red color
31+ func (l * logger ) Errorf (msg string , v ... interface {}) {
32+ Error (fmt .Sprintf (msg , v ... ))
33+ }
34+
35+ // Fatal logs a message with the red color and exits the program
36+ func (l * logger ) Fatal (msg string ) {
37+ Error (msg )
38+ os .Exit (1 )
39+ }
40+
41+ // Fatalf logs a formatted message with the red color and exits the program
42+ func (l * logger ) Fatalf (msg string , v ... interface {}) {
43+ Error (fmt .Sprintf (msg , v ... ))
44+ os .Exit (1 )
45+ }
46+
2047// Debug logs a message with the blue color
2148func (l * logger ) Debug (msg string ) {
2249 Debug (msg )
2350}
2451
52+ // Debugf logs a formatted message with the blue color
53+ func (l * logger ) Debugf (msg string , v ... interface {}) {
54+ Debug (fmt .Sprintf (msg , v ... ))
55+ }
56+
2557// Code is a function that logs based on the status code
2658func (l * logger ) Code (msg string , code int ) {
2759 Code (msg , code )
2860}
2961
62+ // Codef is a function that logs based on the status code
63+ func (l * logger ) Codef (msg string , code int , v ... interface {}) {
64+ Code (fmt .Sprintf (msg , v ... ), code )
65+ }
66+
3067// Warn logs a message with the yellow color
3168func (l * logger ) Warn (msg string ) {
3269 Warn (msg )
3370}
71+
72+ // Warnf logs a formatted message with the yellow color
73+ func (l * logger ) Warnf (msg string , v ... interface {}) {
74+ Warn (fmt .Sprintf (msg , v ... ))
75+ }
0 commit comments