Implementing std.log

Jacob Carlborg doob at me.com
Mon May 9 11:40:54 PDT 2011


On 2011-05-09 20:03, Sean Kelly wrote:
> On May 9, 2011, at 10:45 AM, Andrei Alexandrescu wrote:
>
>> On 5/9/11 12:24 PM, Jacob Carlborg wrote:
>>> I assume the "initLogging" function needs the application command line
>>> because you want to have the name of the application? If that's the
>>> case, I don't like that is handled via the application command line. I
>>> have a function that gets the path of the current process:
>>>
>>> http://dsource.org/projects/tango/attachment/ticket/1536/process.d
>>>
>>> This links to a file attached to a Tango ticket but don't worry, I've
>>> written the whole file myself and I intend to change the license to the
>>> Boost License. It's written with D1 (obviously) but it's very easy to
>>> port to D2, the only dependencies are C functions.
>>>
>>> Feel free to port it to D2 and use it in you're logging library if you
>>> want to.
>>
>> Thanks! In fact, the command-line arguments are needed for considerably more than just the application name. std.log is configurable via application's command line (e.g. --logtostderr --log_dir=/tmp/ etc., see documentation) and extracts these flags using getopt. The rest of the flags are left alone for the application to process.
>
> For what it's worth, the command-line args are available via core.runtime as well.

Ah, you're right.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list