Skip to content

Commit

Permalink
Add commit hash to startup log
Browse files Browse the repository at this point in the history
  • Loading branch information
csfrancis committed Sep 25, 2024
1 parent eb53962 commit 017f5e6
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
GIT_COMMIT := $(shell git rev-parse --short HEAD)

.PHONY: all

.PHONY: build
build: clean
go build -tags release -o dist/proxytv ./cmd/main.go
go build -tags release -o dist/proxytv -ldflags "-X 'main.gitCommit=$(GIT_COMMIT)'" ./cmd/main.go

.PHONY: linux
linux: clean dist
GOOS=linux GOARCH=arm64 go build -tags release -o dist/proxytv ./cmd/main.go
GOOS=linux GOARCH=arm64 go build -tags release -o dist/proxytv -ldflags "-X 'main.gitCommit=$(GIT_COMMIT)'"./cmd/main.go

.PHONY: dist
dist:
Expand Down
8 changes: 7 additions & 1 deletion cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ var (

return ret
}

gitCommit string
)

func (h *SafeUrlHook) Fire(entry *log.Entry) error {
Expand Down Expand Up @@ -77,7 +79,11 @@ func main() {
}
log.SetLevel(logLevel)

log.Infof("starting proxytv with config file: %s", *configPath)
log.WithFields(
log.Fields{
"gitCommit": gitCommit,
"config": *configPath,
}).Info("starting proxytv")

if config.UseFFMPEG {
if _, err := exec.LookPath("ffmpeg"); err != nil {
Expand Down

0 comments on commit 017f5e6

Please sign in to comment.