コード例 #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 );
		}
	}
}
コード例 #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 );
    }
}
コード例 #3
0
ファイル: logging.cpp プロジェクト: HiroyukiSeki/qtplatz
void
Logging::commit_to_broker()
{
    const EventLog::LogMessage& elog = msg.get();
    if ( elog.format.in() && *elog.format.in() != 0 ) {
        Broker::Logger_var logger = static_cast< manager_i *>(*manager_i::instance())->getLogger();
        if ( ! CORBA::is_nil( logger ) ) {
            Broker::LogMessage blog;
            blog.logId = elog.logId;
            blog.priority = elog.priority;
            blog.tv_sec = elog.tv.sec;
            blog.tv_usec = elog.tv.usec;
            blog.msgId = CORBA::wstring_dup( elog.msgId );
            blog.srcId = CORBA::wstring_dup( elog.srcId );
            blog.text = CORBA::wstring_dup( elog.format );
            blog.args.length( elog.args.length() );
            for ( size_t i = 0; i < elog.args.length(); ++i )
                blog.args[i] = CORBA::wstring_dup( elog.args[i] );
            logger->log( blog );
        }
    }
}