Re: [Libreoffice] How to write debug output to console or file?
Hi Mattias, On Fri, 2010-10-29 at 15:49 +1100, Mattias Johnsson wrote: To help with debugging, it'd be very useful for me to be able to write out variable values from within the code. Writing to the console or a file would be fine. Writing to the console using fprintf of std:: is possible. I usually output on the error stream for the debugging purposes. std::cout doesn't work with any of the internal (unicode) string types like OUString. Is there a way to cast them to something that cout can deal with, or is there some logger that can write these strings to a file? The problem here is to get a C string from them: here are some examples: * from OUString: rtl::OUStringToOString( sOUStr, RTL_TEXTENCODING_UTF8 ).getStr() * from String / UniString ByteString( sToolStr, RTL_TEXTENCODING_UTF8 ).GetBufferAccess() I typed those without checking the case... I hope it's OK, otherwise, just check the code for the correct syntax. Regards, -- Cédric Bosdonnat LibreOffice hacker http://documentfoundation.org OOo Eclipse Integration developer http://cedric.bosdonnat.free.fr ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] How to write debug output to console or file?
On Fri, 2010-10-29 at 09:52 +0200, Cedric Bosdonnat wrote: The problem here is to get a C string from them: here are some examples: * from OUString: rtl::OUStringToOString( sOUStr, RTL_TEXTENCODING_UTF8 ).getStr() * from String / UniString ByteString( sToolStr, RTL_TEXTENCODING_UTF8 ).GetBufferAccess() I typed those without checking the case... I hope it's OK, otherwise, just check the code for the correct syntax. As an aside, when you're in gdb print dbg_dump(whatever) should (these days) work again regardless of whether whatever is a OString/OUString/String/ByteString/OStringBuffer/OUStringBuffer. Well, in theory at least, and it does seem to work for me recently again. C. ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] How to write debug output to console or file?
On Fri, 2010-10-29 at 11:59 +0100, Caolán McNamara wrote: On Fri, 2010-10-29 at 09:52 +0200, Cedric Bosdonnat wrote: The problem here is to get a C string from them: here are some examples: * from OUString: rtl::OUStringToOString( sOUStr, RTL_TEXTENCODING_UTF8 ).getStr() Much as I hate the over-use of operator overloading, and the streams idiom; is there a good reason why we can't have some osl::OutputStrm foo aString \n; type thing ? [ as long as we don't go wild and start using this mess all over the place ;-]. Thoughts ? Michael. -- michael.me...@novell.com , Pseudo Engineer, itinerant idiot ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice
Re: [Libreoffice] How to write debug output to console or file?
Hi Michael, Michael Meeks píše v Pá 29. 10. 2010 v 12:14 +0100: The problem here is to get a C string from them: here are some examples: * from OUString: rtl::OUStringToOString( sOUStr, RTL_TEXTENCODING_UTF8 ).getStr() Much as I hate the over-use of operator overloading, and the streams idiom; is there a good reason why we can't have some osl::OutputStrm foo aString \n; type thing ? [ as long as we don't go wild and start using this mess all over the place ;-]. Thoughts ? My complete history of tries fails wrt. doing the debug output easier is here: http://www.openoffice.org/issues/show_bug.cgi?id=65920 At some stage I introduced std::cout foo aString std::endl; in ooo-build, but it was breaking the unit tests in tools: commit 77951e773a286800967046730ff6e536eb7196aa Author: Jan Holesovsky ke...@suse.cz Date: Thu Jul 26 17:40:35 2007 + Kill, breaks tools unit tests (and is not much helpful anyway). * patches/src680/sal-oustring-debug.diff, patches/src680/apply: Kill, breaks tools unit tests (and is not much helpful anyway). Could anybody here re-try see what exactly was going on there? Regards, Kendy ___ LibreOffice mailing list LibreOffice@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice