Hi Filip,

>From include/osg/Notify you have the getNotifyLevel() function...

/** Range of notify levels from DEBUG_FP through to FATAL, ALWAYS
  * is reserved for forcing the absorption of all messages.  The
  * keywords are also used verbatim when specified by the environmental
  * variable OSGNOTIFYLEVEL.  See documentation on osg::notify() for
  * further details.
  */
enum NotifySeverity {
    ALWAYS=0,
    FATAL=1,
    WARN=2,
    NOTICE=3,
    INFO=4,
    DEBUG_INFO=5,
    DEBUG_FP=6
};

/** set the notify level, overriding the default or the value set by
  * the environmental variable OSGNOTIFYLEVEL.
  */
extern OSG_EXPORT void setNotifyLevel(NotifySeverity severity);

/** get the notify level. */
extern OSG_EXPORT NotifySeverity getNotifyLevel();

/** is notification enabled, given the current setNotifyLevel() setting? */
extern OSG_EXPORT bool isNotifyEnabled(NotifySeverity severity);

On Wed, Feb 4, 2009 at 8:46 AM, Filip Holm <filip.h...@gmail.com> wrote:
> Hi all,
>
> I have a non console based application that has it's own reporting
> mechanism built-in. I'd like to be able to set the NotifyLevel and
> have these messages sent to my logger tool. My logger tool also has
> it's own filters/log-levels, so I'd like to be able to map the
> osg::NotifySeverity to some matching log-level.
>
> I've figured out a way to reoute all osg::notify messages to my
> logger, but I can't seem to find a way to get the osg::NotifySeverity
> mapping. Any thoughts on how this could be done is greatly
> appretiated.
>
> What I have done to just flush all osg::notify messages to my logger is:
>
> void main()
> {
>  MyLoggWrapper log;
>  std::streambuf* notifyBuf = osg::notify().rdbuf();
>  osg::notify().rdbuf(log.rdbuf());
>  osg::notify(osg::INFO) << "This message is passed straight to my
> logger, sadly without knowlede of NotifySeverity" << std::endl;
>  <snip>
>  //osgViewer instantiation and main loop etc.
>  </snip>
>  osg::notify().rdbuf(notifyBuf);
> }
>
>
> Filip Holm
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to