winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
4.79k stars 189 forks source link

Adding logs to tf-gcp functions #4904

Open tsuf239 opened 8 months ago

tsuf239 commented 8 months ago

Feature Spec

When running tf-gcp tests, we can't see the logs we're creating using log.

Use Cases

debugging

Implementation Notes

(added by Chriscbr): Current logic depends on implementing invokeWithLogs() method here: https://github.com/winglang/wing/blob/7624e16278478db4499e3b439e0c70e4ba98a1b0/libs/wingsdk/src/shared-gcp/function.inflight.ts#L82-L94. Need to add this or consider alternative logging solutions

Component

SDK

Community Notes

garysassano commented 8 months ago

Could you provide more info about this?

garysassano commented 8 months ago

I think this is probably due to the fact that you are writing standard logs instead of structured logs.

There are probably two approaches to solve this:

garysassano commented 8 months ago

I think we already use Winston somewhere, so maybe an alternative could be using @google-cloud/logging-winston npm module.

tsuf239 commented 7 months ago

Yes, the logs are created successfully in the GCP logs console, to display the logs on the user terminal we need to retrieve them somehow and print them- and that's what this issue is about :) please let me know if further information is needed

Chriscbr commented 5 months ago

Adding contributing-experience label since this will improve the feedback loop for anyone adding resources / capabilities to the GCP target