question

contrejo27 avatar image
contrejo27 asked

Logging in cloud script

I'm a bit lost in how to log statements in cloud script. I was wondering if there was a step by step somewhere or if I could get a concrete example. I'm looking for a place where I can see the different steps of my script for debugging. So a log of things that I write like "Group: <name> created"


I think it has to do with writeeventresponse but I'm not sure
https://docs.microsoft.com/en-us/rest/api/playfab/client/analytics/write-player-event?view=playfab-rest#writeeventresponse

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Gosen Gao avatar image
Gosen Gao answered

The CloudScript has a log system, you can use the “log” object to write out debugging statement. It has three functions corresponding to logging level: debug, info, and error. These functions take a message string and an optional object. These message will return in the response.

Also, you can use PlayStream to log out messages. There are some built-in PlayStream events which are automatically generated by PlayFab, such as group_created. It is triggered when an entity group is created. You can create a Rule which will automatically run an Action when the specific event is triggered. Please make sure the “Publish results as PlayStream Event” is selected and type is “Execute Entity Cloud Script” while creating the Rule. Then you can implement your own log system in the CloudScript. For more information about Rules, please refer to https://docs.microsoft.com/en-us/gaming/playfab/features/automation/actions-rules/quickstart

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.