On Tue, May 1, 2012 at 2:17 PM, Pete Batard <[email protected]> wrote:
> On 2012.04.29 06:42, Arnon Gilboa wrote:
> >> I see that you used wdi_register_logger() in an "Hack for wdi logging"
> >> section (currenlty disabled).
> >> Can you elaborate on the limitation you found there and if you would
> >> like an enhancement of libwdi's logging facility?
> >>
> > I simply wanted wdi used by the service to log to a file instead of a
> > pipe/stdout, so I gave it dummy args and patched about 5 lines in the
> > libwdi logger code. Do you think my patch for that will be useful by
> others?
>
> Not sure. My current view is that standard Windows applications (even
> ones that don't actually have a visible Window, such as a service) that
> want to get some logging and can't use stdout would use the standard
> Windows messaging functionality, even if that means creating a hidden
> Windows where the messages can be directed to. This is what
> wdi_register_logger() provides, and because the creation of windows is
> the core of Windows, the overhead is expected to be minimal.
>
If I'm not a service, I use the following to get logging output to a
console window:
AllocConsole();
freopen("CONOUT$", "a", stdout);
Otherwise, I use CreateFile/WriteFile to write to a file. (I have to use
the native windows calls if I want to set sharing modes such that I can
read the file while my executable is running, otherwise an freopen on
stdout or stderr would do the trick.)
Orin.
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
libusbx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/libusbx-devel