std.log available for viewing

Jose Armando Garcia jsancio at gmail.com
Sun May 29 16:59:25 PDT 2011


By default the module will read the command line arguments looking for
known option. For any option that is missing the default will be used.
The default for each option is described in FilterConfig,
VerboseConfig and LoggerConfig. I.e. the module works without any
explicit initialization by the user. Look at 'share static this()'.

On Sun, May 29, 2011 at 3:22 PM, Jacob Carlborg <doob at me.com> wrote:
> On 2011-05-29 17:10, Jose Armando Garcia wrote:
>>
>> 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
>
> I guess that that is acceptable. BTW, what happens if you start logging
> without passing any command line arguments or initializing the library? Does
> it have a default behavior making it usable?
>
> --
> /Jacob Carlborg
>


More information about the Digitalmars-d mailing list