Skip to content

Commit

Permalink
Merge pull request #22 from seipan/fix/tests-example-refactor
Browse files Browse the repository at this point in the history
tests(logger) :logger  examples refactor
  • Loading branch information
seipan committed Oct 25, 2023
2 parents dc27ad5 + 8ee4685 commit f554744
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,19 @@ func TestDiscordExample(t *testing.T) {
logger.DebugContext(context.Background(), "test")
logger.NoSendInfo()
logger.Infof("test %s", "info")
}

func TestDiscordExampleWithContext(t *testing.T) {
logger := NewLogger("", "test", "discord", DiscordWebhookURL)
logger.SetLevel(DebugLevel)
logger.SetWebhook(DiscordWebhookURL)

logger.NoSendDebug()
logger.DebugContext(context.Background(), "test")
logger.NoSendInfo()
logger.InfoContext(context.Background(), "test")
logger.NoSendWarn()
logger.WarnContext(context.Background(), "test")
}

func TestSlackExample(t *testing.T) {
Expand All @@ -55,5 +67,17 @@ func TestSlackExample(t *testing.T) {

logger.NoSendDebug()
logger.Debugf("test %s", "debug")
}

func TestSlackExampleWithContext(t *testing.T) {
logger := NewLogger("", "test", "slack", SlackWebhookURL)
logger.SetLevel(DebugLevel)
logger.SetWebhook(SlackWebhookURL)

logger.NoSendDebug()
logger.DebugContext(context.Background(), "test")
logger.NoSendInfo()
logger.InfoContext(context.Background(), "test")
logger.NoSendWarn()
logger.WarnContext(context.Background(), "test")
}

0 comments on commit f554744

Please sign in to comment.