summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnjan Nath <kaludios@gmail.com>2022-07-04 14:59:32 +0530
committerAnjan Nath <kaludios@gmail.com>2022-07-04 15:17:21 +0530
commitfbe1c1ec72293edcf61d7293f330e3d0ef6f2130 (patch)
tree57fb45931b018331cbc5aa74ee7326e59b61fbea
parent1de62aea0a77a79a4205950e9d590753cba09019 (diff)
Use log.Printf only when a format is provided
This adds a check to c.log to see if the format string is empty if its empty use log.Print and if a format is provided then use log.Printf
-rw-r--r--client/client.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/client/client.go b/client/client.go
index c203e2b..e67546a 100644
--- a/client/client.go
+++ b/client/client.go
@@ -98,8 +98,11 @@ func (c *Client) log(state string, format string, a ...interface{}) {
c.EventLogger.Log(state, fmt.Sprintf(format, a...))
return
}
+ if format == "" {
+ log.Print(a...)
+ return
+ }
log.Printf(format, a...)
-
}
func (c *Client) error(format string, a ...interface{}) {
@@ -107,6 +110,10 @@ func (c *Client) error(format string, a ...interface{}) {
c.EventLogger.Error(fmt.Sprintf(format, a...))
return
}
+ if format == "" {
+ log.Print(a...)
+ return
+ }
log.Printf(format, a...)
}