forked from stakwork/sphinx-tribes
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create a logger util (stakwork#2225)
* Create a logger util * modified the logger so we dont need to instantiate first --------- Co-authored-by: kevkevinpal <[email protected]>
- Loading branch information
1 parent
48986e8
commit efdcbc9
Showing
2 changed files
with
33 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package utils | ||
|
||
import ( | ||
"log" | ||
"os" | ||
) | ||
|
||
type Logger struct { | ||
infoLogger *log.Logger | ||
errorLogger *log.Logger | ||
debugLogger *log.Logger | ||
} | ||
|
||
var Log = Logger{ | ||
infoLogger: log.New(os.Stdout, "INFO: ", log.Ldate|log.Ltime|log.Lshortfile), | ||
errorLogger: log.New(os.Stderr, "ERROR: ", log.Ldate|log.Ltime|log.Lshortfile), | ||
debugLogger: log.New(os.Stdout, "DEBUG: ", log.Ldate|log.Ltime|log.Lshortfile), | ||
} | ||
|
||
func (l *Logger) Info(format string, v ...interface{}) { | ||
l.infoLogger.Printf(format, v...) | ||
} | ||
|
||
func (l *Logger) Error(format string, v ...interface{}) { | ||
l.errorLogger.Printf(format, v...) | ||
} | ||
|
||
func (l *Logger) Debug(format string, v ...interface{}) { | ||
l.debugLogger.Printf(format, v...) | ||
} |