std.log available for viewing

Jose Armando Garcia jsancio at gmail.com
Sun May 29 08:10:17 PDT 2011


Configuring through the command line is optional for example the
following command line:

$ program --minloglevel=warning --v=3 --logdir=/tmp

Translate to the following in code:

---
import std.log;

void main(string[] args)
{
   FilterConfig filterConfig;
   filterConfig.minSeverity = Level.warning;
   filterCofnig.verboseConfig.maxVerboseLevel = 3;

   LoggerConfig loggerConfig;
   loggerConfig.logDirectory = "/tmp";

   initializeLogging!SharedLogger(loggerConfig, filterConfig);

   //...
}
---

I.e. all the command line options are also available programmatically.
The reverse is not the case. All programmatic options are not
available at the command line.

Fine point about 'dfatal' and 'vlog'. I was trying to keep the
interface as close to glog as possible where it is warranted but I
have not problem changing it to 'debugFatal' and 'verbose'.

Thanks,
-Jose

On Sun, May 29, 2011 at 7:07 AM, Jacob Carlborg <doob at me.com> wrote:
> On 2011-05-29 01:40, Jose Armando Garcia 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,
>> -Jose
>
> Why is everyone that contribute with a std.log implementation keep insisting
> that it should be configured via command line options? This is not how a
> library should be configured, it should be configured via regular methods
> like the rest of Phobos. If an application wants to set logging options via
> the command line then that's up to the application to implement.
>
> I don't like the abbreviations, "vlog" and "dfatal". I first thought you had
> an error in the documentation when I saw "fatal" and "dfatal". I would
> suggest "verbose" and "debugFatal", it's clear what they mean and it's
> consistent with how the other logging levels are named. There's always the
> option to alias a method for the users.
>
> --
> /Jacob Carlborg
>


More information about the Digitalmars-d mailing list