Skip to content

Commit

Permalink
feat : Add slack send e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
seipan committed Feb 22, 2024
1 parent 2d37dc9 commit f68ccb8
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
func eToeTest(discordWebhookURL string, slackWebhookURL string) error {
testNosend()
testDiscordSend(discordWebhookURL)
testSendSlack(slackWebhookURL)
return nil
}

Expand Down Expand Up @@ -45,3 +46,25 @@ func testDiscordSend(discordWebhookURL string) {
logger.FatalContext(context.Background(), "test")
logger.Fatalf("test %s", "fatal")
}

func testSendSlack(slackWebhookURL string) {
logger := loghook.NewLogger("", "test", "slack", slackWebhookURL)
logger.SetLevel(loghook.DebugLevel)
logger.SetWebhook("")

logger.Debug("test")
logger.DebugContext(context.Background(), "test")
logger.Debugf("test %s", "debug")
logger.Info("test")
logger.InfoContext(context.Background(), "test")
logger.Infof("test %s", "info")
logger.Warn("test")
logger.WarnContext(context.Background(), "test")
logger.Warnf("test %s", "warn")
logger.Error("test")
logger.ErrorContext(context.Background(), "test")
logger.Errorf("test %s", "error")
logger.Fatal("test")
logger.FatalContext(context.Background(), "test")
logger.Fatalf("test %s", "fatal")
}

0 comments on commit f68ccb8

Please sign in to comment.