Skip to content

Commit 3e0de03

Browse files
authored
Merge pull request #8 from m-terra/log-timestamp
add log timestamp
2 parents c442765 + 3e5700c commit 3e0de03

File tree

2 files changed

+2
-8
lines changed

2 files changed

+2
-8
lines changed

main.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,7 @@ import (
1313
"github.com/snorwin/haproxy-reload-wrapper/pkg/utils"
1414
)
1515

16-
var (
17-
Version = "v0.0.0"
18-
Hash = ""
19-
)
20-
2116
func main() {
22-
log.Notice(fmt.Sprintf("haproxy-reload-wrapper version is %s-%s", Version, Hash))
23-
2417
// fetch the absolut path of the haproxy executable
2518
executable, err := utils.LookupExecutablePathAbs("haproxy")
2619
if err != nil {

pkg/log/log.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package log
33
import (
44
"fmt"
55
"os"
6+
"time"
67
)
78

89
const (
@@ -29,5 +30,5 @@ func Notice(msg string) {
2930
}
3031

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

0 commit comments

Comments
 (0)