GoogleCloudPlatform / functions-framework-dart

FaaS (Function as a service) framework for writing portable Dart functions
https://pub.dev/packages/functions_framework
Apache License 2.0
535 stars 54 forks source link

Generated project (from dartfn) logs CloudEvent awkwardly #351

Closed craiglabenz closed 1 year ago

craiglabenz commented 1 year ago

The generated file from dartfn contains this code in lib/functions.dart

stderr.writeln(_encoder.convert(event));

Which renders awkwardly in the Cloud Run console with extraneous newlines and separate log statements.

Screen Shot 2022-10-31 at 12 59 24 PM
kevmoo commented 1 year ago

Weird indeed!

craiglabenz commented 1 year ago

I could play with this, but I'll pretty much just be trying random things and re-deploying until something changes with no real theory of which layer is overly splitting the message.

If you have any ideas of where to start, I can tinker.

kevmoo commented 1 year ago

I think I get it. It's just multi-line text by the time it gets to the logger.

It's possible that if we just emit it as valid JSON in a single line, it'd format better on Cloud – but we harder to understand on the local console.

Not sure this is a bug in THIS project, or just a quirk of how Cloud logging works.

What would you like changed?

(The newlines are not extraneous, it's just how Cloud Logging handles multi-line prints)