Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 11, 2011 [phobos] Would like to add std.log to the review queue | ||||
---|---|---|---|---|
| ||||
Hello everyone, What do I need to do to add std.log to the review queue? The implementation is feature complete and it should work in both Windows and Linux. The documentation: http://jsancio.github.com/phobos/phobos/std_log.html The code: https://github.com/jsancio/phobos/blob/master/std/log.d druntime changes: https://github.com/jsancio/druntime/commit/06ac77dca29b350b7079929588755e6b15ca52a5 If you want to give the library a try, probably the best thing to do is clone my forks. I keep them fairly up to date with the official branches. For phobos use the master branch and the branch for druntime is log. Enjoy and thanks, -Jose |
June 12, 2011 [phobos] Would like to add std.log to the review queue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jose Armando Garcia | I'd say you just added it. ;) David's TempAlloc is currently being reviewed, and my std.path is next in line. std.log could follow that.
-Lars
On Sat, 2011-06-11 at 21:49 -0300, Jose Armando Garcia wrote:
> Hello everyone,
>
> What do I need to do to add std.log to the review queue? The implementation is feature complete and it should work in both Windows and Linux.
>
> The documentation: http://jsancio.github.com/phobos/phobos/std_log.html The code: https://github.com/jsancio/phobos/blob/master/std/log.d
>
> druntime changes: https://github.com/jsancio/druntime/commit/06ac77dca29b350b7079929588755e6b15ca52a5
>
> If you want to give the library a try, probably the best thing to do is clone my forks. I keep them fairly up to date with the official branches. For phobos use the master branch and the branch for druntime is log.
>
> Enjoy and thanks,
> -Jose
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
|
June 13, 2011 [phobos] Would like to add std.log to the review queue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jose Armando Garcia | On Sat, 11 Jun 2011 20:49:18 -0400, Jose Armando Garcia <jsancio at gmail.com> wrote:
> Hello everyone,
>
> What do I need to do to add std.log to the review queue? The implementation is feature complete and it should work in both Windows and Linux.
>
> The documentation: http://jsancio.github.com/phobos/phobos/std_log.html The code: https://github.com/jsancio/phobos/blob/master/std/log.d
>
> druntime changes: https://github.com/jsancio/druntime/commit/06ac77dca29b350b7079929588755e6b15ca52a5
>
> If you want to give the library a try, probably the best thing to do is clone my forks. I keep them fairly up to date with the official branches. For phobos use the master branch and the branch for druntime is log.
>
> Enjoy and thanks,
> -Jose
I've taken a quick look at the API. I notice you've put all the severity levels into the public name space. I.e. fatal, error, etc. And the primary use of the severity levels is as template arguments to log, i.e. log!warning(). This feels like pointless namespace pollution. Is there a reason static struct members, i.e. log.warning(), log.error(), etc., or free functions, i.e. logWarning() or log_warning(), are inferior solutions?
|
June 13, 2011 [phobos] Would like to add std.log to the review queue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Robert Jacques | On Mon, Jun 13, 2011 at 2:50 PM, Robert Jacques <sandford at jhu.edu> wrote:
> On Sat, 11 Jun 2011 20:49:18 -0400, Jose Armando Garcia <jsancio at gmail.com> wrote:
>>
>> Hello everyone,
>>
>> What do I need to do to add std.log to the review queue? The implementation is feature complete and it should work in both Windows and Linux.
>>
>> The documentation: http://jsancio.github.com/phobos/phobos/std_log.html The code: https://github.com/jsancio/phobos/blob/master/std/log.d
>>
>> druntime changes:
>>
>> https://github.com/jsancio/druntime/commit/06ac77dca29b350b7079929588755e6b15ca52a5
>>
>> If you want to give the library a try, probably the best thing to do is clone my forks. I keep them fairly up to date with the official branches. For phobos use the master branch and the branch for druntime is log.
>>
>> Enjoy and thanks,
>> -Jose
>
> I've taken a quick look at the API. I notice you've put all the severity
> levels into the public name space. I.e. fatal, error, etc. And the primary
> use of the severity levels is as template arguments to log, i.e.
> log!warning(). This feels like pointless namespace pollution. Is there a
> reason static struct members, i.e. log.warning(), log.error(), etc., or free
> functions, i.e. logWarning() or log_warning(), are inferior solutions?
>
Functions are not enough. I need them to be templates because of compile time disabling of logging. Conditionally compiling based on the version flag needs to be done when the client code is compiled not when the library/phobos is compiled. I think only templates give me this functionality but I could be wrong.
I can make them free standing template but to use them the client must:
logInfo!()("Hello world");
Argh! Maybe we can use strings:
log!"info"("Hello word");
or a char:
log!'i'("Hello"); log!'I'("World");
Running out of ideas. Anything better?
-Jose
|
June 13, 2011 [phobos] Would like to add std.log to the review queue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jose Armando Garcia | On 13.06.2011 23:56, Jose Armando Garcia wrote: > On Mon, Jun 13, 2011 at 2:50 PM, Robert Jacques<sandford at jhu.edu> wrote: >> On Sat, 11 Jun 2011 20:49:18 -0400, Jose Armando Garcia<jsancio at gmail.com> wrote: >>> Hello everyone, >>> >>> What do I need to do to add std.log to the review queue? The implementation is feature complete and it should work in both Windows and Linux. >>> >>> The documentation: http://jsancio.github.com/phobos/phobos/std_log.html The code: https://github.com/jsancio/phobos/blob/master/std/log.d >>> >>> druntime changes: >>> >>> https://github.com/jsancio/druntime/commit/06ac77dca29b350b7079929588755e6b15ca52a5 >>> >>> If you want to give the library a try, probably the best thing to do is clone my forks. I keep them fairly up to date with the official branches. For phobos use the master branch and the branch for druntime is log. >>> >>> Enjoy and thanks, >>> -Jose >> I've taken a quick look at the API. I notice you've put all the severity >> levels into the public name space. I.e. fatal, error, etc. And the primary >> use of the severity levels is as template arguments to log, i.e. >> log!warning(). This feels like pointless namespace pollution. Is there a >> reason static struct members, i.e. log.warning(), log.error(), etc., or free >> functions, i.e. logWarning() or log_warning(), are inferior solutions? >> > Functions are not enough. I need them to be templates because of compile time disabling of logging. Conditionally compiling based on the version flag needs to be done when the client code is compiled not when the library/phobos is compiled. I think only templates give me this functionality but I could be wrong. > > I can make them free standing template but to use them the client must: > > logInfo!()("Hello world"); > > Argh! Maybe we can use strings: > > log!"info"("Hello word"); > > or a char: > > log!'i'("Hello"); log!'I'("World"); > > Running out of ideas. Anything better? > From the top of my head - would opDispatch be of any use? It is template. -- Dmitry Olshansky |
June 13, 2011 [phobos] Would like to add std.log to the review queue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Jose Armando Garcia | On Mon, Jun 13, 2011 at 3:56 PM, Jose Armando Garcia <jsancio at gmail.com>wrote: > > I can make them free standing template but to use them the client must: > > logInfo!()("Hello world"); > IFTI with parameterless templates works fine: int doStuff()(int num) { return num + 1; } void main() { doStuff(1); } -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20110613/a4bdff06/attachment.html> |
June 13, 2011 [phobos] Would like to add std.log to the review queue | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | On Mon, Jun 13, 2011 at 3:59 PM, David Simcha <dsimcha at gmail.com> wrote: > > > On Mon, Jun 13, 2011 at 3:56 PM, Jose Armando Garcia <jsancio at gmail.com>wrote: > >> >> I can make them free standing template but to use them the client must: >> >> logInfo!()("Hello world"); >> > > IFTI with parameterless templates works fine: > > int doStuff()(int num) { > return num + 1; > } > > void main() { > doStuff(1); > } > > BTW, this trick is useful when you need to work around Bug 2972 and effectively overload a function against a template. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.puremagic.com/pipermail/phobos/attachments/20110613/8fcdc4eb/attachment.html> |
June 13, 2011 [phobos] Would like to add std.log to the review queue | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | On Mon, Jun 13, 2011 at 4:59 PM, David Simcha <dsimcha at gmail.com> wrote:
>
>
> On Mon, Jun 13, 2011 at 3:56 PM, Jose Armando Garcia <jsancio at gmail.com> wrote:
>>
>> I can make them free standing template but to use them the client must:
>>
>> logInfo!()("Hello world");
>
> IFTI with parameterless templates works fine:
>
> int doStuff()(int num) {
> ??? return num + 1;
> }
>
> void main() {
> ??? doStuff(1);
> }
>
logInfo is not a template function. It is a template. And it is used to alias against an internal object. Looks something like this:
private LogFilter _info; // provides a bunch of methods including
when, opCall(), etc.
template logInfo()
{
alias _info logInfo;
}
I haven''t tried your solution but I think the API would look like this:
doStuff()("Info message");
|
June 13, 2011 [phobos] Would like to add std.log to the review queue | ||||
---|---|---|---|---|
| ||||
Posted in reply to Dmitry Olshansky | On Mon, Jun 13, 2011 at 4:58 PM, Dmitry Olshansky <dmitry.olsh at gmail.com> wrote:
> On 13.06.2011 23:56, Jose Armando Garcia wrote:
>>
>> On Mon, Jun 13, 2011 at 2:50 PM, Robert Jacques<sandford at jhu.edu> ?wrote:
>>>
>>> On Sat, 11 Jun 2011 20:49:18 -0400, Jose Armando
>>> Garcia<jsancio at gmail.com>
>>> wrote:
>>>>
>>>> Hello everyone,
>>>>
>>>> What do I need to do to add std.log to the review queue? The implementation is feature complete and it should work in both Windows and Linux.
>>>>
>>>> The documentation: http://jsancio.github.com/phobos/phobos/std_log.html The code: https://github.com/jsancio/phobos/blob/master/std/log.d
>>>>
>>>> druntime changes:
>>>>
>>>>
>>>> https://github.com/jsancio/druntime/commit/06ac77dca29b350b7079929588755e6b15ca52a5
>>>>
>>>> If you want to give the library a try, probably the best thing to do is clone my forks. I keep them fairly up to date with the official branches. For phobos use the master branch and the branch for druntime is log.
>>>>
>>>> Enjoy and thanks,
>>>> -Jose
>>>
>>> I've taken a quick look at the API. I notice you've put all the severity
>>> levels into the public name space. I.e. fatal, error, etc. And the
>>> primary
>>> use of the severity levels is as template arguments to log, i.e.
>>> log!warning(). This feels like pointless namespace pollution. Is there a
>>> reason static struct members, i.e. log.warning(), log.error(), etc., or
>>> free
>>> functions, i.e. logWarning() or log_warning(), are inferior solutions?
>>>
>> Functions are not enough. I need them to be templates because of compile time disabling of logging. Conditionally compiling based on the version flag needs to be done when the client code is compiled not when the library/phobos is compiled. I think only templates give me this functionality but I could be wrong.
>>
>> I can make them free standing template but to use them the client must:
>>
>> logInfo!()("Hello world");
>>
>> Argh! Maybe we can use strings:
>>
>> log!"info"("Hello word");
>>
>> or a char:
>>
>> log!'i'("Hello"); log!'I'("World");
>>
>> Running out of ideas. Anything better?
>>
> From the top of my head - would opDispatch be of any use? It is template.
>
> --
> Dmitry Olshansky
>
Not sure. Need to investigate this.
|
June 13, 2011 [phobos] Would like to add std.log to the review queue | ||||
---|---|---|---|---|
| ||||
Posted in reply to David Simcha | On 2011-06-13 12:59, David Simcha wrote: > On Mon, Jun 13, 2011 at 3:56 PM, Jose Armando Garcia <jsancio at gmail.com>wrote: > > I can make them free standing template but to use them the client must: > > > > logInfo!()("Hello world"); > > IFTI with parameterless templates works fine: > > int doStuff()(int num) { > return num + 1; > } > > void main() { > doStuff(1); > } Wow. I did not know that. When I had to do that I've always templatized the parameter and used a template constraint to guarantee that the type was the one that that the parameter is always suppposed to be. Being able to have an empty template parameter list is much better. Thanks for the tip! - Jonathan M Davis |
Copyright © 1999-2021 by the D Language Foundation