Implementing std.log

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon May 9 10:34:29 PDT 2011


On 5/9/11 12:14 PM, Jacob Carlborg wrote:
> On 2011-05-09 17:49, Andrei Alexandrescu wrote:
>> On 5/9/11 10:37 AM, Jacob Carlborg wrote:
>>> Isn't the name of the log file a little too verbose? Don't know if I'm
>>> missing something but this doesn't seem so useful for long running
>>> application that use logging. As far as I know you usually have one log
>>> file per application and outputs the message along with the level and
>>> date and time.
>>
>> I did what glog does. Going forward, there is a private static string
>> for formatting file names using positional parameters. In the future I'm
>> considering providing an API for changing that format string, which
>> means the log file format will be user-definable. (Same about the format
>> of individual messages - see the string constants fileNameFormat and
>> format toward the top of log.d.) Positional parameters look a bit odd
>> but they are quite flexible.
>>
>> Andrei
>
> I don't think the positional parameters are odd (C# has them with
> another syntax and Tango uses the same syntax as C#), I think they're
> very usable. Although the syntax you've chosen looks a little odd to me.
> Wouldn't it make more sense to have the $ in front of the number instead
> of behind, since the % is in front.

I used the Posix positional format syntax, see 
http://pubs.opengroup.org/onlinepubs/009695399/functions/printf.html.

Andrei



More information about the Digitalmars-d mailing list