views:

210

answers:

2

I just need a simple JSON or YAML (or other) text based format for recording the time I spend on tasks. I prefer to do as much work as possible in my text editor (e text editor) so it is more natural to me to stay in the editor and not switch back and forth to programs like Excel (plus this way I retain portable and "open" data). The idea is that if I record all my tasks in JSON or YAML format then I could easily use IRB (interactive Ruby) or some other interactive programming session to create a work log report for myself. Also I could use this to generate reports for my clients pretty easily at the end of some particular time period.

It would nice if the format already exists and that the format has some mechanism for coping with the following problem: some data that I record should be for "internal use only" whereas other data could be safe for "external" use. In other words, one problem I would like to avoid is the trouble of sifting back through text work logs in order to filter items that should not be forward to the client.

Q: Why JSON or YAML???
A: JSON or YAML seems to have a cleaner syntax than creating something with XML. Remember I am the one who has to type the log so I am not interested in typing a bunch of extra closing tags.

A: 

How about using XML? >:)

Greg
because JSON or YAML is cleaner therefore faster for me to type
fooledbyprimes
+1  A: 

You can create whatever format you want, which is the principle advantage of going with YAML or JSON in the first place. In fact there's nothing stopping you from writing all your text files in YAML or JSON other than your own working style and personal preference.

### myyamllog.txt
  - log_entry: posted some stuff on stack overflow
    project:   prj_my_personal_stuff
    datestamp: 2008-11-14 07:58
    summary: answering a question on formatted text for logs
    body: |  
        you can create a "dummy" log entry as a text editor snippet
        and just paste a new entry every time you start a new project.
        The snippet will just contain placeholders for the parts you have
        to fill in by hand. Timestamp will be auto-populated when you paste.

  - log_entry: followup on SO answer
    project:   prj_my_personal_stuff
    datestamp: 2008-11-14 08:10
    summary: 
    body: | 
        As far as a "standardized" format, you can pick anything you want.
        One suggestion is to just make each individual log entry a simple 
        series of name-value pairs. Then combine those individual entries
        as a series of YAML sequence elements. The benefit of this is it
        reflects the layout of a single database table. The sequence elements
        are records and the name-value pairs are fields.

The nice thing about this, is if you have a boss who prefers excel, or a content management system that uses HTML, its not too difficult to change this format into some other output destination format. Which is probably what you've already noticed, hence your question about standard formats.

My advice, just use whatever fields you want to use, then structure it into a "table", then find tools that translate text tables into and out of various different formats, if one doesn't exist for the format you need, write a translator yourself in python, perl, ruby, whatever.

dreftymac