mirror of
https://github.com/DominicBreuker/pspy.git
synced 2025-12-21 11:44:51 +00:00
experiment with some tests
This commit is contained in:
committed by
Dominic Breuker
parent
cb48cc1b37
commit
f5ca2dad75
35
internal/logging/logging.go
Normal file
35
internal/logging/logging.go
Normal file
@@ -0,0 +1,35 @@
|
||||
package logging
|
||||
|
||||
import (
|
||||
"log"
|
||||
"os"
|
||||
)
|
||||
|
||||
type Logger struct {
|
||||
infoLogger *log.Logger
|
||||
errorLogger *log.Logger
|
||||
eventLogger *log.Logger
|
||||
}
|
||||
|
||||
func NewLogger() *Logger {
|
||||
return &Logger{
|
||||
infoLogger: log.New(os.Stdout, "", 0),
|
||||
errorLogger: log.New(os.Stderr, "", 0),
|
||||
eventLogger: log.New(os.Stdout, "", log.Ldate|log.Ltime),
|
||||
}
|
||||
}
|
||||
|
||||
// Infof writes an info message to stdout
|
||||
func (l *Logger) Infof(format string, v ...interface{}) {
|
||||
l.infoLogger.Printf(format, v...)
|
||||
}
|
||||
|
||||
// Errorf writes an error message to stderr
|
||||
func (l *Logger) Errorf(format string, v ...interface{}) {
|
||||
l.errorLogger.Printf(format, v...)
|
||||
}
|
||||
|
||||
// Eventf writes an event with timestamp to stdout
|
||||
func (l *Logger) Eventf(format string, v ...interface{}) {
|
||||
l.eventLogger.Printf(format, v...)
|
||||
}
|
||||
Reference in New Issue
Block a user