openfaas / of-watchdog

Reverse proxy for STDIO and HTTP microservices
MIT License
259 stars 115 forks source link

Log some additional internal messages to stderr #120

Closed alexellis closed 3 years ago

alexellis commented 3 years ago

Signed-off-by: Alex Ellis (OpenFaaS Ltd) alexellis2@gmail.com

Description

Log some additional internal messages to stderr

Motivation and Context

This change makes the watchdog log its internal messages to stderr only - using log.Print.

Prior to the PR, there were a few instances of using fmt.Print

Addresses one point raised in #75

How Has This Been Tested?

Tested with go build and running a test workload. The forking message used to be printed to stdout.

alex@alex-nuc8:~/go/src/github.com/openfaas/of-watchdog$ upstream_url="http://127.0.0.1:8003" mode=http fprocess="$HOME/go/src/github.com/alexellis/inlets-pro/bin/inlets-pro http fileserver -a --port 8003" ./of-watchdog 
2021/02/08 11:37:29 Forking - /home/alex/go/src/github.com/alexellis/inlets-pro/bin/inlets-pro [http fileserver -a --port 8003]
2021/02/08 11:37:29 Started logging stderr from function.
2021/02/08 11:37:29 Started logging stdout from function.
2021/02/08 11:37:29 OperationalMode: http
2021/02/08 11:37:29 Timeouts: read: 10s, write: 10s hard: 10s.
2021/02/08 11:37:29 Listening on port: 8080
2021/02/08 11:37:29 Writing lock-file to: /tmp/.lock
2021/02/08 11:37:29 Metrics listening on port: 8081
2021/02/08 11:37:29 stderr: 2021/02/08 11:37:29 Starting inlets PRO fileserver. Version 0.8.0-rc4 - 8e2bec5866b6a5cca12a50a4dc5d795fcae225e4
2021/02/08 11:37:29 stderr: 2021/02/08 11:37:29 Serving: /home/alex/go/src/github.com/openfaas/of-watchdog, on 127.0.0.1:8003, browsing: true, auth: false
2021/02/08 11:37:35 stderr: 2021/02/08 11:37:35 Request: localhost:8003 / [f9148891-cd56-4d3b-9565-525a6254ca2a]
2021/02/08 11:37:35 stderr: 2021/02/08 11:37:35 Sent /home/alex/go/src/github.com/openfaas/of-watchdog (4.1 kB) [f9148891-cd56-4d3b-9565-525a6254ca2a]
2021/02/08 11:37:39 stderr: 2021/02/08 11:37:39 Request: localhost:8003 /main.go [6fe88987-df2a-47d5-b66c-b96815642d4a]
2021/02/08 11:37:39 stderr: 2021/02/08 11:37:39 Sent /home/alex/go/src/github.com/openfaas/of-watchdog/main.go (10.3 kB) [6fe88987-df2a-47d5-b66c-b96815642d4a]

Types of changes

Checklist: