You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Were you able to successfully deploy your functions?
Yes
Additional
When using @google-cloud/logging, everything works:
// Imports the Google Cloud client libraryimport{Logging}from"@google-cloud/logging";asyncfunctionquickstart(projectId="PROJECT_ID",// Your Google Cloud Platform project IDlogName="my-log"// The name of the log to write to){// Creates a clientconstlogging=newLogging({ projectId });// Selects the log to write toconstlog=logging.log(logName);// The metadata associated with the entryconstmetadata={resource: {type: "global"},// See: https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry#logseverityseverity: "INFO",};constjson={message: "Hello, world!",userId: "123",};// Prepares a log entryconstentry=log.entry(metadata,json);asyncfunctionwriteLog(){// Writes the log entryawaitlog.write(entry);console.log(`Logged: ${JSON.stringify(json)}`);}// eslint-disable-next-line @typescript-eslint/no-floating-promiseswriteLog();}// eslint-disable-next-line @typescript-eslint/no-floating-promisesquickstart();
The text was updated successfully, but these errors were encountered:
Pretty sure the string message has to be the first parameter of the function call, and then the structured payload as the second one? Like you'd want to be doing
functions.logger.info("we are healthy", {
userId: "123",
});
I'll definitely pass on the comment that our docs could be better about this.
Yes, this work @Berlioz, thanks! 👍 But also thanks to @mbleigh for fixing this so both solutions work 🎉 Because the way described in this issue is how Cloud Logging shows it in their documentation.
Related issues
[REQUIRED] Version info
node: 16
firebase-functions:
4.4.0
firebase-tools:
11.24.1
firebase-admin:
10.3.0
[REQUIRED] Test case
[REQUIRED] Steps to reproduce
[REQUIRED] Expected behavior
[REQUIRED] Actual behavior
message
is an empty string.Were you able to successfully deploy your functions?
Yes
Additional
When using
@google-cloud/logging
, everything works:The text was updated successfully, but these errors were encountered: