std.log available for viewing

Jose Armando Garcia jsancio at gmail.com
Sun May 29 17:26:06 PDT 2011


Comments below.

Thanks!

2011/5/29 Masahiro Nakagawa <repeatedly at gmail.com>:
> On Sun, 29 May 2011 08:40:16 +0900, Jose Armando Garcia <jsancio at gmail.com>
> wrote:
>
>> The implementation and documentation for std.log is ready for viewing.
>> You can take a look at the doc at
>> http://jsancio.github.com/phobos/phobos/std_log.html. The source code
>> is at https://github.com/jsancio/phobos/blob/master/std/log.d.
>>
>> I had to make some changes to druntime to get the thread id. The
>> module will work without the changes but you wont to see thread ids in
>> your log messages. I will look into sending a pull request to
>> druntime, in the meantime you can apply the attached patch to your
>> druntime if you want to see thread ids in the log.
>>
>> Let me know if you have any comments or suggestions! Thanks,
>
> - every, first, after
> These are useful? I can't image the use cases.
> I think 'when(cond)' is enough.
>

Let's say you have a loop or a function that gets executed many times
but you only want to see the message every number of times or just the
first time. I had to do this many times myself. Why not just provide a
standard way of doing this?

> - fatal, error and other global variables
> 'logger.error("hoge")' seems to be better than 'error("hoge")'.
> error("hoge") is not clear in complicated context. In addition,
> I think defining general name variables on global scope is bad.
>

Those symbols are declared in the std.log namespace or module not in
the global namespace. You can use:

static import std.log;
//...
std.log.error("hoge");

or

import log = std.log;
// ...
log.error("hoge");

Take a look at module imports at:
http://d-programming-language.org/module.html#ImportDeclaration

>
> Masahiro
>


More information about the Digitalmars-d mailing list