daxie
daxie

Reputation: 41

using golang logging library, where does one see localhost logs?

following the golang library instructions if you write logs with the client library, where can one see those logs when running your server locally during development (eg via go run main.go)?

in my case (not sure if it's relevant) i'm using the library as part of golang logic in appengine, and even the relevant-looking instructions on "viewing logs" for those docs don't mention local development explicitly. Is that because it (running gcloud app logs tail and seeing local server logs) should "just work" or because there's no way to see logs for a local logs sdk interaction?

Upvotes: 0

Views: 790

Answers (1)

daxie
daxie

Reputation: 41

tl;dr Tentatively answering myself: that's not supported - instead one has to just conditionally swap out calls to regular logger if env (eg empty GAE_INSTANCE env variable) indicates you're on localhost.

Walking through the code under the NewClient(...) call on the logging package, I end up a spot where the upstream API is really being called (note the rpc context used by the very last turtle - I never saw logic as I walked through that seemed to be switching to something for local development), so I suspect there really is no emulation capturing.


EDIT: See DazWilkin's helpful answer below for more context

Upvotes: 1

Related Questions