Hi Paul,

Actually You have to redirect both stdout and stderr
osgviewer cow.osg  > foo.txt 2>&1

On windows "standard" way of logging is to use OutputDebugString function
that connects application to windows debugging facilities (i.e output window
of visual studio). Many libraries print debug messages this way including
MFC, WxWidgets and Qt.

My intention is to incorporate OSG notifications into GUI applications. For
instance I would like to display notifications in a GUI list widget with
messages coloured according to notification severity. In Qt you can do this
by installing custom message sink with qInstallMsgHandler. In OSG you're
stuck with plain std::ostream handle and no severity information.

My proposal is to replace stdout and stderr returned by osg::notify with
custom stream that uses osg::NotifyHandler as message sink (similar to
qInstallMsgHandler in Qt).

Regards,
Maciej

2009/5/13 Paul Martz <[email protected]>

>  Hi Simon and Marciej --
>
> On Windows, I can already do the following:
>     set OSG_NOTIFY_LEVEL=DEBUG
>     osgviewer cow.osg > foo.txt
> All of the notify output goes to the foo.txt text file.
>
> Paul Martz
> *Skew Matrix Software LLC*
> http://www.skew-matrix.com
> +1 303 859 9466
>
>
>  ------------------------------
> *From:* [email protected] [mailto:
> [email protected]] *On Behalf Of *Maciej Krol
> *Sent:* Tuesday, May 12, 2009 11:35 PM
> *To:* OpenSceneGraph Users
> *Subject:* Re: [osg-users] Repost: Top 10 debugging tips
>
> Hi Simon, Paul et al,
>
> Yesterday I've posted to osg-submissions notification redirection
> interface. For windows you could redirect messages to debug output with
> single line of code.
>
> osg::setNotifyHandler(new osg::WinDebugNotifyHandler)
>
> You can define custom notification sinks by implementing osg::NotifyHandler
> interface:
>
> class MyNotifyHandler : public osg::NotifyHandler
> {
>   void notify(osg::NotifySeverity severity, const char *message)
>   {
>      printf("severity %d: %s", severity, message);
>   }
> }
>
> Apart from visual studio debugger output I use DebugView
> http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx all the
> time, it is a little tool from SysInternals (now Microsoft) that shows debug
> messages from all applications. Very handy when You try to solve problems
> with released application at target system and no debugger is available.
>
> Regards,
> Maciej
>
> 2009/5/13 Simon Hammett <[email protected]>
>
>> Many, (most?) osg users are using windozes.
>> So redirecting osg::notify messages should be in that list.
>>
>> (Plz somebody give me a job developing for *ix.!)
>>
>> 2009/5/12 Paul Martz <[email protected]>:
>>  > I've created the following list of debugging tips to help new OSG
>> developers
>> > become productive faster:
>> >   http://www.skew-matrix.com/bb/viewtopic.php?f=6&t=5
>> >
>> > I hope you find it useful. Feedback appreciated.
>> >
>> > Paul Martz
>> > Skew Matrix Software LLC
>> > http://www.skew-matrix.com
>> > +1 303 859 9466
>> >
>> > _______________________________________________
>> > osg-users mailing list
>> > [email protected]
>> >
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>> >
>> >
>>
>>
>>
>> --
>> http://www.ssTk.co.uk
>> _______________________________________________
>> osg-users mailing list
>> [email protected]
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>


-- 
Regards,
Maciej Krol
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to