[phobos] User define datetime format
Jose Armando Garcia
jsancio at gmail.com
Mon Jun 6 21:34:50 PDT 2011
On Tue, Jun 7, 2011 at 1:05 AM, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> On 2011-06-06 20:41, Jose Armando Garcia wrote:
>> On Tue, Jun 7, 2011 at 12:03 AM, Andrei Alexandrescu <andrei at erdani.com>
> wrote:
>> > Jose,
>> >
>> >
>> > I suggest you use simple Posix positional parameters. Jonathan has a few
>> > tips on how to make that fast. You should be able to get many formats
>> > that way.
>>
>> I am planning to use positional parameters internally but I didn't
>> want the user to have to remember that %1$s is for timestamp, %2$x is
>> for thread id, etc. So instead I was thinking of having the user input
>> "%t %i" which internally gets translated to "%1$s %2$x" (I already
>> have the code for this).
>>
>> %t would map to SysTime.toISOString(). If they wanted to create a
>> custom date/time format they use "%{...}t". So, for example "%{%a, %d
>> %b %Y %T %z}t" would result in "Tue, 07 Apr 2011 00:36:04 +0000".
>
> I would suggest that you either use toISOExtString or toString/toSimpleString
> rather than toISOString, because toISOString is nigh-on-unreadable. It's more
> compact, and it's standard, but no one is going to want to read it.
> toString/toSimpleString would be the easiest to read, but it isn't standard.
> toISOExtString is standard and somewhat readable, so take your pick. But I'd
> advise against toISOString unless you're specifically going for compactness
> over legibility.
>
> - Jonathan M Davis
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>
Thanks. I'll use toISOExtString. I would like the default log line to
be easy to parse by both humans and computers.
More information about the phobos
mailing list