Change File: YAML vs. JSON vs. CSV

I am creating a simple Changelog lib in CodeIgniter that will basically log a post every time someone adds, removes, modifies or posts a blog post. I will register messages in files in batches of 300. Thus, every 301st message is sent to a new file. At first I wanted to write logs to simple .log files, but then I had the idea to actually style this thing, and I had to separate each “attribute” of each message (that is: user, message, type of log, etc. ) So .log files are out of the question since retrieving the information will be painful.

What is the most suitable format for such a task? I have already excluded MySQL and XML because they are too heavy (especially considering that the log files will not exceed 300 lines). I suggested YAML vs JSON vs CSV in the title, but is there an even better alternative?

+3
source share
2 answers

I would say it all depends on what you need / need to do with these files:

  • CSV has one advantage: it can be imported into Excel and such applications that may be useful in some situations to perform reporting to the boss, for example
  • JSON is read in many languages, including Javascript; but not easy to read by man; and harder to change "manually"
  • YAML ; ; .


:

, ^^


, CSV ( Excel), JSON ( ).

+2

, CSV - :

  • ( )
  • JSON

, JSON , .

+1

Source: https://habr.com/ru/post/1732386/


All Articles