go_log/main_test.go

37 lines
872 B
Go
Raw Normal View History

2022-10-11 06:06:26 +02:00
package main
2022-10-11 07:30:46 +02:00
import (
"testing"
"time"
)
2022-10-11 06:06:26 +02:00
func TestDefault(t *testing.T) {
testLog := Log{}
testLog.SetDefaultValues()
testLog.Context = []Metadata{
{
Name: "foo",
Value: "bar",
},
{
Name: "lur",
Value: "pelle",
},
}
testLog.Info("bosse")
testLog.ErrorM("frasse", []Metadata{{Name: "wat", Value: ":O"}})
}
2022-10-11 07:30:46 +02:00
func TestWoo(t *testing.T) {
loc, _ := time.LoadLocation("UTC")
log := Log{
Context: []Metadata{}, // Will be prepended to metadata on all log entries
MinLogLvl: Info, // Minimal log level to output
Fmt: DefaultFmt, // Log message formatter
Stderr: DefaultStderr, // Log message outputter for Debug, Verbose and Info
Stdout: DefaultStdout, // Log message outputter for Warning and Error
TimeLocation: loc, // Timestamp location/time zone setting
}
log.Info("wat")
}