diff options
author | Runxi Yu <me@runxiyu.org> | 2025-04-05 18:37:55 +0800 |
---|---|---|
committer | Runxi Yu <me@runxiyu.org> | 2025-04-05 18:37:55 +0800 |
commit | 4836dd8b0be10b461b93d711bb2cf78d186210d1 (patch) | |
tree | 3c84ec801c234c9bc1dfe1062e3a32710ae3e254 /irc.go | |
parent | Separate code/README rendering and unsafe to their own packages (diff) | |
download | forge-4836dd8b0be10b461b93d711bb2cf78d186210d1.tar.gz forge-4836dd8b0be10b461b93d711bb2cf78d186210d1.tar.zst forge-4836dd8b0be10b461b93d711bb2cf78d186210d1.zip |
Use log/slog instead of clog
Diffstat (limited to 'irc.go')
-rw-r--r-- | irc.go | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -5,9 +5,9 @@ package main import ( "crypto/tls" + "log/slog" "net" - "go.lindenii.runxiyu.org/lindenii-common/clog" irc "go.lindenii.runxiyu.org/lindenii-irc" ) @@ -37,7 +37,7 @@ func ircBotSession() error { conn := irc.NewConn(underlyingConn) logAndWriteLn := func(s string) (n int, err error) { - clog.Debug("IRC tx: " + s) + slog.Debug("irc tx", "line", s) return conn.WriteString(s + "\r\n") } @@ -66,7 +66,7 @@ func ircBotSession() error { return } - clog.Debug("IRC rx: " + line) + slog.Debug("irc rx", "line", line) switch msg.Command { case "001": @@ -84,7 +84,7 @@ func ircBotSession() error { case "JOIN": c, ok := msg.Source.(irc.Client) if !ok { - clog.Error("IRC server told us a non-client is joining a channel...") + slog.Error("unable to convert source of JOIN to client") } if c.Nick != config.IRC.Nick { continue @@ -104,7 +104,7 @@ func ircBotSession() error { select { case ircSendBuffered <- line: default: - clog.Error("unable to requeue IRC message: " + line) + slog.Error("unable to requeue message", "line", line) } writeLoopAbort <- struct{}{} return err @@ -140,6 +140,6 @@ func ircBotLoop() { for { err := ircBotSession() - clog.Error("IRC error: " + err.Error()) + slog.Error("irc session error", "error", err) } } |