From 0bdb70eadd752dc1a6652801768c370981953389 Mon Sep 17 00:00:00 2001 From: Philipp Hirsch Date: Tue, 5 Sep 2023 13:31:34 +0200 Subject: [PATCH] Implement Write function to fulfill io.Writer interface --- slacklogger.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/slacklogger.go b/slacklogger.go index 35cc3b6..dda6217 100644 --- a/slacklogger.go +++ b/slacklogger.go @@ -23,6 +23,12 @@ func (logger *SlackLogger) Log(message string) { LogWithURL(message, logger.webhookURL, logger.environment, logger.isDebug) } +func (logger *SlackLogger) Write(message []byte) (int, error) { + logger.Log(string(message)) + + return len(message), nil +} + func LogWithURL(message, url, env string, isDebug bool) { if env != "" { message = fmt.Sprintf("env=%s, %s", env, message)