in reply to YAML for logs?

I've seen people make the same arguments about using Lisp as a serialization format for log files. In your case, you lose if you use YAML because of the multiple version thing going on. Hopefully there's a stream reading YAML library. If so, just feed it a handle and go to town.

Personally I hate YAML because I find it impossible to edit by hand even though people keep assuring me that it's designed for that. They're liars, all. I've found I nearly always need a computer to write the YAML for me. It's a stupid, stupid language and somehow, for some strange reason, it's the fad right now. It makes me want to puke on my shoes.

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Replies are listed 'Best First'.
Re^2: YAML for logs?
by blazar (Canon) on Nov 25, 2006 at 17:31 UTC
    Personally I hate YAML because I find it impossible to edit by hand even though people keep assuring me that it's designed for that. They're liars, all. I've found I nearly always need a computer to write the YAML for me. It's a stupid, stupid language and somehow, for some strange reason, it's the fad right now. It makes me want to puke on my shoes.

    I respect your opinion very much so I'll take into account and for sure do not disregard it with an "I don't agree" a priori. I may concede on the writing bit, and indeed it seems to me that it should be easy, but I've not really done that. Seriously, I mean. But here I was more focusing on the reading bit. For example, these are the last five lines for my (Apache's) access_log at http://blazar.perlmonk.org/:

    If I run them through

    #!/usr/bin/perl use strict; use warnings; use Parse::AccessLogEntry; use YAML::Syck; my $p=Parse::AccessLogEntry->new; chomp, print Dump $p->parse($_) while <>; __END__

    I get the following, which is only marginally more verbose than the original, but in a way that clears up the meaning of things, and IMHO largely more readable.

    I can imagine further "advantages" if some hierarachical info were to be included.

      I'm bitchy about YAML purely because of the last dozen times I tried writing some by hand, I failed because YAML syntax is more obscure than my current understanding. I recall going to the YAML web site to find a quick description but there was just a big reference doc and that was more overhead than I wanted. YAML is supposed to be simple, right? Well it's not. Actually, I don't think YAML is supposed to be simple. I'd rather write my data in Perl or lisp. The former is common to everyon here and the latter is so simple that any moron can write it.

      ⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

        The docs are rather weighty. What I used as an introduction to the syntax was Ingy's YAML docs (see YAML Terminology)
Re^2: YAML for logs?
by clinton (Priest) on Nov 25, 2006 at 17:05 UTC
    You're kidding, right??!?

    I've given up sliced bread for breakfast in favour of YAML! I've done a number of projects which have a lot of configuration, and YAML makes this as easy as pie. Or sliced bread.

    Call me a liar, ... oh you did already... but which of these is easier to read and maintain:

    Granted, I can't see any purpose at all in using it for logging...
Re^2: YAML for logs?
by chromatic (Archbishop) on Nov 25, 2006 at 20:44 UTC

    I like YAML, but I've also never managed to write it by hand. I generally create the appropriate data structure in Perl, then serialize it to YAML and use that as a template for further files. See hack #12 in Perl Hacks, for example.

      It's simple, really. Try spending several minutes reading this cookbook.

      My only gripe with YAML is that I haven't found a module to manipulate YAML while _preserving_ the comments.

Re^2: YAML for logs?
by j3 (Friar) on Nov 25, 2006 at 22:52 UTC
    {snip} and somehow, for some strange reason, it's the fad right now.

    It's popular with the Ruby crowd. I think Rails also uses it as an alternative to CSV files.