Review of Jose Armando Garcia Sancio's std.log

jdrewsen jdrewsen at nospam.com
Tue Feb 14 10:33:42 PST 2012


On Tuesday, 14 February 2012 at 17:48:06 UTC, so wrote:
> On Tuesday, 14 February 2012 at 16:21:42 UTC, Jose Armando 
> Garcia wrote:
>> On Tue, Feb 14, 2012 at 8:42 AM, jdrewsen 
>> <jdrewsen at nospam.com> wrote:
>>> On Tuesday, 14 February 2012 at 02:28:11 UTC, Jose Armando 
>>> Garcia wrote:
>>>>
>>>> On Mon, Feb 13, 2012 at 6:44 PM, jdrewsen 
>>>> <jdrewsen at nospam.com> wrote:
>>>>>
>>>>> A first quick observation:
>>>>>
>>>>> I vote for a debug severity level. Then make that default 
>>>>> to the template
>>>>> parameter for log:
>>>>>
>>>>> template log(Severity severity = Severity.debug)
>>>>>
>>>>> That would make it nice for good old print debugging.
>>>>>
>>>>> log("This is a dbg message");
>>>>>
>>>>
>>>> I like the idea of having a default. Not sure about adding 
>>>> debug. What
>>>> are you trying to do with default that log!info and vlog(#) 
>>>> doesn't
>>>> let you do?
>>>
>>>
>>> As Sean mentioned the vlog function may be the one I want. 
>>> Maybe it is okey
>>> not to have a debug severity but then a default on the vlog 
>>> level parameter
>>> would be nice. That would make quick debug prints a tad 
>>> simpler
>>>
>> If we do set a default what should it be? It is not clear to 
>> me what
>> value we should pick so if you have any suggestions let me 
>> know.
>
> IMO a default severity level is not a good idea, not explicit 
> to begin with.
> As i suggested on another reply, getting rid of the 
> instantiations solve it.
>
> We lose nothing and gain a common keyword. I used to have 
> severity levels for my logging library in c++. As soon as i got 
> the C++0x options i thrashed them all.
>
> Now instead of:
>
> txt(error) << "this is: " << it;
>
> i just got:
>
> error("this is: ", it);
>
> Win win for every aspect of it. And got rid of the keyword 
> "txt".

I also like your proposal better. In the end I just want a simple 
to type function call syntax or it will be tempting to fallback 
to writeln(...).

/Jonas



More information about the Digitalmars-d mailing list