From 02a96cc89009ba778db8d4ac90b592fd3cec5664 Mon Sep 17 00:00:00 2001 From: cryptonote-social Date: Tue, 5 Jan 2021 14:35:34 -0800 Subject: [PATCH] function for printing a single chat --- miner.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/miner.go b/miner.go index 672b6dc..75168fc 100644 --- a/miner.go +++ b/miner.go @@ -160,7 +160,7 @@ func Mine(c *MinerConfig) error { u = client.UNAUTHENTICATED_USER_STRING + " (sent by you)" crylog.Warn("Sending chat without authentication. Provide -wallet string with your user login to authenticate.") } - crylog.Info("\n\n[", u, "] (", time.Now().Truncate(time.Second), ")\n", chatMsg, "\n") + printChat(u, time.Now().Unix(), chatMsg) } } @@ -248,7 +248,7 @@ func printStatsPeriodically() { for c := chat.NextChatReceived(); c != nil; c = chat.NextChatReceived() { _, ok := chatsSent[c.ID] if !ok { - crylog.Info("\n\n[", c.Username, "] (", time.Unix(c.Timestamp, 0), ")\n", c.Message, "\n") + printChat(c.Username, c.Timestamp, c.Message) } else { crylog.Info("queued chat successfully sent") } @@ -256,6 +256,11 @@ func printStatsPeriodically() { } } +func printChat(unm string, ts int64, msg string) { + date := time.Unix(ts, 0).Format(time.RFC1123) + crylog.Info("\n\n[", unm, "] (", date, ")\n", msg, "\n") +} + func monitorMachineState(ch chan MachineState) { for state := range ch { switch state {