Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+2 votes
273 views
in Q2A Core by

I just wonder why eventlog params column storing string in strange key=val format and why not serialized or json?

Currently it is storing in this format

postid=22 parentid= parent= title=function return ...

Why don't you store in simply json or serialized like this

{"postid":22,"parentid":"","title":"function return ..."}
or
a:3:{s:6:"postid";i:22;s:8:"parentid";s:0:"";s:5:"title";s:19:"function return ...";}

Is there any specific reason or never though on it?

by
bump................
by
Seems like there is not answer on it!

1 Answer

+1 vote
by
As far as I know the logs are not actually used anywhere in Q2A, so there is little cause for them to be "parseable" like serialising them would. The main intent is for them to be easily readable, so the simple key=value format works well for that.

JSON isn't too far away from what we have already but adds "noise" with extra quotation marks and braces. Also early Q2A versions still supported PHP4 which don't have json_encode so it couldn't easily be used.
by
Thanks Scott,

What I believe is usually the developer will read that column and in that case JSON also has good readily. Also one simple function to decode it. My mind is still battling to get convinced with the reason to keep the string the way it is. I would suggest and prefer to convert in to JSON if not serialized.

Event logger is very useful data just depend on developer how s/he utilize it. I am not sure about other but I am utilizing it for various stuffs and because of such string I have to create own table to write it as JSON and that is the reason the question came up in my mind.

This was just my suggestion rest up to you and Gideon if it is good for Q2A otherwise I am already writing my data into custom table.
...