summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/hashicorp/memberlist/logging.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/hashicorp/memberlist/logging.go')
-rw-r--r--vendor/github.com/hashicorp/memberlist/logging.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/memberlist/logging.go b/vendor/github.com/hashicorp/memberlist/logging.go
new file mode 100644
index 000000000..f31acfb2f
--- /dev/null
+++ b/vendor/github.com/hashicorp/memberlist/logging.go
@@ -0,0 +1,22 @@
+package memberlist
+
+import (
+ "fmt"
+ "net"
+)
+
+func LogAddress(addr net.Addr) string {
+ if addr == nil {
+ return "from=<unknown address>"
+ }
+
+ return fmt.Sprintf("from=%s", addr.String())
+}
+
+func LogConn(conn net.Conn) string {
+ if conn == nil {
+ return LogAddress(nil)
+ }
+
+ return LogAddress(conn.RemoteAddr())
+}