googlearchive / cloud-functions-go

Unofficial Native Go Runtime for Google Cloud Functions
Apache License 2.0
423 stars 44 forks source link

Added support for logging via the supervisor #20

Closed ssttevee closed 6 years ago

ssttevee commented 6 years ago

Resolves #13.

The batching logic mirrors that of the logger from the worker.js retrieved by following the instructions from #16.

The logger may be used directly:

nodego.InfoLogger.Println("Hello World!")

or via the log package after calling nodego.OverrideLogger()

func init() {
    nodego.OverrideLogger()
}

...

log.Println("Hello World")
googlebot commented 6 years ago

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

:memo: Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


ssttevee commented 6 years ago

I signed it!

googlebot commented 6 years ago

CLAs look good, thanks!

ssttevee commented 6 years ago

I added a WithLogger middleware function that gets the Function-Execution-Id header and includes in new log entries. I'm not sure there's anything else for it to do.

ssttevee commented 6 years ago

I have moved things around and un-exported the functions that don't need to be exported. I also added the flushing mechanism but somewhere in the back of my mind, it doesn't feel like the best approach.

iangudger commented 6 years ago

Also update the README.md file?

It still says "Logging is not supported (yet)." https://github.com/GoogleCloudPlatform/cloud-functions-go#limitations

iangudger commented 6 years ago

All of the new files need a copyright/license header at the top. Ex: https://github.com/GoogleCloudPlatform/cloud-functions-go/blob/master/nodego/nodego.go

ssttevee commented 6 years ago

Moved functions related to the mutex into an named type as per your suggestion. I also fixed some other bugs here and there. Added readme logging section and license preambles as well.