Skip to content

Commit

Permalink
Merge pull request #8 from m-terra/log-timestamp
Browse files Browse the repository at this point in the history
add log timestamp
  • Loading branch information
snorwin authored Jun 30, 2023
2 parents c442765 + 3e5700c commit 3e0de03
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
7 changes: 0 additions & 7 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,7 @@ import (
"github.com/snorwin/haproxy-reload-wrapper/pkg/utils"
)

var (
Version = "v0.0.0"
Hash = ""
)

func main() {
log.Notice(fmt.Sprintf("haproxy-reload-wrapper version is %s-%s", Version, Hash))

// fetch the absolut path of the haproxy executable
executable, err := utils.LookupExecutablePathAbs("haproxy")
if err != nil {
Expand Down
3 changes: 2 additions & 1 deletion pkg/log/log.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package log
import (
"fmt"
"os"
"time"
)

const (
Expand All @@ -29,5 +30,5 @@ func Notice(msg string) {
}

func log(level string, pid int, msg string) {
fmt.Printf("%-10s (%d) : %s\n", fmt.Sprintf("[%s]", level), pid, msg)
fmt.Printf("%s %-10s (%d) : %s\n", time.Now().Format(time.RFC3339Nano), fmt.Sprintf("[%s]", level), pid, msg)
}

0 comments on commit 3e0de03

Please sign in to comment.