Example #1
0
void
ServantPluginImpl::init_debug_adbroker( Broker::Manager_var& mgr )
{
	manager_ = mgr;

	if ( ! CORBA::is_nil( manager_ ) ) {

        try {
            Broker::Session_var broker = manager_->getSession( L"debug" );
            if ( ! CORBA::is_nil( broker ) ) 
                broker->connect( "user", "pass", "debug", 0 );
        } catch ( CORBA::Exception& ex ) {
            adportable::debug(__FILE__, __LINE__) << ex._info().c_str();
            return;
        }
        
		connect( this, SIGNAL( signal_notify_update( unsigned long ) )
                 , this, SLOT( handle_notify_update( unsigned long ) ) );
        
		Broker::Logger_var logger = manager_->getLogger();

		if ( ! CORBA::is_nil( logger.in() ) ) {
			logger->register_handler( logHandler_._this() );

			Broker::LogMessage msg;
            msg.tv_sec = msg.tv_usec = 0;
			msg.text = L"init_abroker initialized";
			logger->log( msg );
		}
	}
}
Example #2
0
void
ServantPluginImpl::handle_notify_update( unsigned long logid )
{
    Broker::Logger_var logger = manager_->getLogger();
    if ( CORBA::is_nil( logger.in() ) )
        return;
    Broker::LogMessage msg;
    if ( logger->findLog( logid, msg ) ) {
        CORBA::WString_var text = logger->to_string( msg );
        std::wstring wtext = static_cast<wchar_t *>(text);
        outputWindow_->appendLog( wtext );
    }
}