From 988e39ce755055ef8e8cadb571bbb93db1465af0 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Sun, 16 Jun 2019 00:15:13 -0700 Subject: [PATCH] Add doc comment --- internal/utils/connlogger.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/utils/connlogger.go b/internal/utils/connlogger.go index 0b02d10ed..775cc4cd9 100644 --- a/internal/utils/connlogger.go +++ b/internal/utils/connlogger.go @@ -34,28 +34,34 @@ func streamLogger(s net.Stream, l log.Logger) log.Logger { return connLogger(s.Conn(), l).New("streamProtocolID", s.Protocol()) } +// Listen logs a listener starting listening on an address. func (cl ConnLogger) Listen(n net.Network, ma ma.Multiaddr) { WithCaller(netLogger(n, cl.l)). Debug("listener starting", "listenAddress", ma) } +// ListenClose logs a listener stopping listening on an address. func (cl ConnLogger) ListenClose(n net.Network, ma ma.Multiaddr) { WithCaller(netLogger(n, cl.l)). Debug("listener closing", "listenAddress", ma) } +// Connected logs a connection getting opened. func (cl ConnLogger) Connected(n net.Network, c net.Conn) { WithCaller(connLogger(c, netLogger(n, cl.l))).Debug("connected") } +// Disconnected logs a connection getting closed. func (cl ConnLogger) Disconnected(n net.Network, c net.Conn) { WithCaller(connLogger(c, netLogger(n, cl.l))).Debug("disconnected") } +// OpenedStream logs a new stream getting opened. func (cl ConnLogger) OpenedStream(n net.Network, s net.Stream) { WithCaller(streamLogger(s, netLogger(n, cl.l))).Debug("stream opened") } +// ClosedStream logs a stream getting closed. func (cl ConnLogger) ClosedStream(n net.Network, s net.Stream) { WithCaller(streamLogger(s, netLogger(n, cl.l))).Debug("stream closed") }