Skip to content

Commit

Permalink
🔊 Set RepositoryCallerEncoder
Browse files Browse the repository at this point in the history
  • Loading branch information
nkmr-jp committed May 30, 2022
1 parent 1108705 commit b8f2c4a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ FUNC_NAME=fetch
ENTRY_POINT=Fetch
TOPIC_NAME=$(FUNC_NAME)-topic
BUCKET_NAME=$(PROJECT_ID)-fetch
VERSION=$(shell git rev-parse --short HEAD)

init:
@echo
Expand Down Expand Up @@ -43,7 +44,7 @@ deploy:
--runtime go116 \
--trigger-topic $(FUNC_NAME)-topic \
--entry-point $(ENTRY_POINT) \
--set-env-vars BUCKET_NAME=$(BUCKET_NAME) \
--set-env-vars BUCKET_NAME=$(BUCKET_NAME),VERSION=$(VERSION) \
--source .

show:
Expand Down
6 changes: 6 additions & 0 deletions fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,12 @@ func save(ctx context.Context, bucket, object string, buf *bytes.Buffer) error {
}

func initLogger() {
urlFormat := "https://github.com/nkmr-jp/gcf-fetch/blob/%s"
srcRootDir := "/workspace/serverless_function_source_code"
version := os.Getenv("VERSION")
zl.SetVersion(version)
zl.SetRepositoryCallerEncoder(urlFormat, version, srcRootDir)

if os.Getenv("FUNCTION_TARGET") != "" {
zl.SetOutput(zl.ConsoleOutput)
zl.SetOmitKeys(zl.PIDKey, zl.HostnameKey)
Expand Down

0 comments on commit b8f2c4a

Please sign in to comment.