On Monday, 28 May 2012 at 18:53:50 UTC, Ali Çehreli wrote:
On 05/28/2012 11:50 AM, "Jarl André" <jarl.an...@gmail.com>" wrote:

> 1. Is there a way to convert from string "INFO" to
LogLevel.INFO, by name?

conv.to can do that:

import std.conv;

enum LogLevel { ALL, INFO, WARNING }

void main()
{
    enum l = to!LogLevel("INFO");
    assert(l == LogLevel.INFO);
}

> 2. does it really not exist any functional logging libraries
for D2?

There has been discussions about that not too long ago.

Ali

Thanks. I have now implemented a logging library that actually looks to imitate log4j. If I log to any level then it checks if the current logLevel is equal to or lesser than the incoming loglevel. It might be using the wrong scale, e.g. ALL is 6 and OFF is 0, but it works. And its not really log4j so who cares ;)

Reply via email to