log/log_test.go

43 lines
1.1 KiB
Go
Raw Permalink Normal View History

2023-04-30 18:57:06 +00:00
package log
import "testing"
func TestPrint(t *testing.T) {
t.Setenv("LOGLEVEL", "DEBUG")
Print(DEBUG, "Testing DEBUG")
Print(DEBUG, "Testing DEBUG", 1, 2.3456, true)
Print(INFO, "Testing INFO")
Print(INFO, "Testing INFO", 1, 2.3456, true)
Print(WARNING, "Testing WARNING")
Print(WARNING, "Testing WARNING", 1, 2.3456, true)
Print(ERROR, "Testing ERROR")
Print(ERROR, "Testing ERROR", 1, 2.3456, true)
}
func TestPrintDebug(t *testing.T) {
t.Setenv("LOGLEVEL", "DEBUG")
PrintDebug("Testing DEBUG")
PrintDebug("Testing DEBUG", 1, 2.3456, true)
}
func TestPrintInfo(t *testing.T) {
t.Setenv("LOGLEVEL", "INFO")
PrintInfo("Testing INFO")
PrintInfo("Testing INFO", 1, 2.3456, true)
Print(DEBUG, "Testing DEBUG")
}
func TestPrintWarning(t *testing.T) {
t.Setenv("LOGLEVEL", "WARNING")
PrintWarning("Testing WARNING")
PrintWarning("Testing WARNING", 1, 2.3456, true)
PrintInfo("Testing INFO")
}
func TestPrintError(t *testing.T) {
t.Setenv("LOGLEVEL", "ERROR")
PrintError("Testing ERROR")
PrintError("Testing ERROR", 1, 2.3456, true)
PrintWarning("Testing WARNING")
}