Determine the LogEvent that LogEventRequest/LogEventResponse is straddling?
J
Jeff Amiel
started a topic
over 6 years ago
I'm looking to add some functionality to ALL custom events in a single place...and GameSparks gives me the handy LogEventRequest and LogEventResponse scripts where I can add pre and post hooks to any custom event. Yay!!!
I was interested in adding some logging (in my case of timing information) to each custom event - and as part of the code I want to add to LogEventRequest/LogEventResponse, I want to Spark.getLog().Debug some data that I can look at later. However, what gets added to runtime.log includes the script name of "LogEventResponse" (which makes sense). However - what I am interested in is the name of the script that actually precedes the LogEventResponse (the script event that was actually called by the client).
Any thoughts?
my goal is NOT to go in and touch the source to each custom EventLog script to add functionality if I can help it..
Best Answer
C
Customer Support
said
over 6 years ago
Hi Jeff
You can use Spark.getData().eventKey; to get the shortcode for the script and put that in the log message.
You can use Spark.getData().eventKey; to get the shortcode for the script and put that in the log message.
Regards
Katie
J
Jeff Amiel
said
over 6 years ago
worked perfect!!
(I had to pull it out in LogEventRequest and tuck it into player scriptData and pull it out later in LogEventResponse - but I was already doing that for other data)
Thanks for the quick response!!!
E
Eric Moncada
said
over 5 years ago
I'm interested to get event name in LogEventResponse.
Spark.getData().eventKey does not work.
I wouldn't want to store it in player scriptData to avoid overload.
Is there another solution to pass info from LogEventRequest to LogEventResponse ?
Customer Support
said
over 5 years ago
Hi Eric,
You can pass it from the request to the response with the following.
//LogEventRequest
Spark.setScriptData("eventKey", Spark.getData().eventKey);
//LogEventResponse
var eventKey= Spark.getScriptData("eventKey");
Try that and let us know how you get on.
Regards,
Liam
E
Eric Moncada
said
over 5 years ago
Hi Liam,
Thanks a lot, was using Spark.getData() instead of Spark.setScriptData();
Jeff Amiel
I'm looking to add some functionality to ALL custom events in a single place...and GameSparks gives me the handy LogEventRequest and LogEventResponse scripts where I can add pre and post hooks to any custom event. Yay!!!
I was interested in adding some logging (in my case of timing information) to each custom event - and as part of the code I want to add to LogEventRequest/LogEventResponse, I want to Spark.getLog().Debug some data that I can look at later. However, what gets added to runtime.log includes the script name of "LogEventResponse" (which makes sense). However - what I am interested in is the name of the script that actually precedes the LogEventResponse (the script event that was actually called by the client).
Any thoughts?
my goal is NOT to go in and touch the source to each custom EventLog script to add functionality if I can help it..
Hi Jeff
You can use Spark.getData().eventKey; to get the shortcode for the script and put that in the log message.
Regards
Katie
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstCustomer Support
Hi Jeff
You can use Spark.getData().eventKey; to get the shortcode for the script and put that in the log message.
Regards
Katie
Jeff Amiel
worked perfect!!
(I had to pull it out in LogEventRequest and tuck it into player scriptData and pull it out later in LogEventResponse - but I was already doing that for other data)
Thanks for the quick response!!!
Eric Moncada
I'm interested to get event name in LogEventResponse.
Spark.getData().eventKey does not work.
I wouldn't want to store it in player scriptData to avoid overload.
Is there another solution to pass info from LogEventRequest to LogEventResponse ?
Customer Support
Hi Eric,
You can pass it from the request to the response with the following.
Try that and let us know how you get on.
Regards,
Liam
Eric Moncada
Hi Liam,
Thanks a lot, was using Spark.getData() instead of Spark.setScriptData();
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics