当前位置: 首页>>代码示例>>C++>>正文


C++ wlog函数代码示例

本文整理汇总了C++中wlog函数的典型用法代码示例。如果您正苦于以下问题:C++ wlog函数的具体用法?C++ wlog怎么用?C++ wlog使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wlog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: option

  void tcp_socket::enable_keep_alives(const fc::microseconds& interval)
  {
    if (interval.count())
    {
      boost::asio::socket_base::keep_alive option(true);
      my->_sock.set_option(option);
#if defined _WIN32 || defined WIN32 || defined OS_WIN64 || defined _WIN64 || defined WIN64 || defined WINNT
      struct tcp_keepalive keepalive_settings;
      keepalive_settings.onoff = 1;
      keepalive_settings.keepalivetime = (ULONG)(interval.count() / fc::milliseconds(1).count());
      keepalive_settings.keepaliveinterval = (ULONG)(interval.count() / fc::milliseconds(1).count());

      DWORD dwBytesRet = 0;
      if (WSAIoctl(my->_sock.native(), SIO_KEEPALIVE_VALS, &keepalive_settings, sizeof(keepalive_settings),
                   NULL, 0, &dwBytesRet, NULL, NULL) == SOCKET_ERROR)
        wlog("Error setting TCP keepalive values");
#elif !defined(__clang__) || (__clang_major__ >= 6)
      // This should work for modern Linuxes and for OSX >= Mountain Lion
      int timeout_sec = interval.count() / fc::seconds(1).count();
      if (setsockopt(my->_sock.native(), IPPROTO_TCP, 
      #if defined( __APPLE__ )
                     TCP_KEEPALIVE,
       #else
                     TCP_KEEPIDLE, 
       #endif
                     (char*)&timeout_sec, sizeof(timeout_sec)) < 0)
        wlog("Error setting TCP keepalive idle time");
# if !defined(__APPLE__) || defined(TCP_KEEPINTVL) // TCP_KEEPINTVL not defined before 10.9
      if (setsockopt(my->_sock.native(), IPPROTO_TCP, TCP_KEEPINTVL, 
                     (char*)&timeout_sec, sizeof(timeout_sec)) < 0)
        wlog("Error setting TCP keepalive interval");
# endif // !__APPLE__ || TCP_KEEPINTVL
#endif // !WIN32
    }
    else
    {
      boost::asio::socket_base::keep_alive option(false);
      my->_sock.set_option(option);
    }
  }
开发者ID:BestSilent,项目名称:eos,代码行数:40,代码来源:tcp_socket.cpp

示例2: get_next_bid

                  bool get_next_bid()
                  { try {
                     if( _current_bid && _current_bid->get_quantity().amount > 0 )
                        return _current_bid.valid();

                     _current_bid.reset();
                     if( _bid_itr.valid() )
                     {
                        auto bid = market_order( bid_order, _bid_itr.key(), _bid_itr.value() );
                        if( bid.get_price().quote_asset_id == _quote_id &&
                            bid.get_price().base_asset_id == _base_id )
                        {
                            _current_bid = bid;
                        }
                     }

                     if( _short_itr.valid() )
                     {
                        auto bid = market_order( short_order, _short_itr.key(), _short_itr.value() );
                        wlog( "SHORT ITER VALID: ${o}", ("o",bid) );
                        if( bid.get_price().quote_asset_id == _quote_id &&
                            bid.get_price().base_asset_id == _base_id )
                        {
                            if( !_current_bid || _current_bid->get_price() < bid.get_price() )
                            {
                               --_short_itr;
                               _current_bid = bid;
                               ilog( "returning ${v}", ("v",_current_bid.valid() ) );
                               return _current_bid.valid();
                            }
                        }
                     }
                     else
                     {
                        wlog( "           No Shorts         ****   " );
                     }
                     if( _bid_itr.valid() ) --_bid_itr;
                     return _current_bid.valid();
                  } FC_CAPTURE_AND_RETHROW() }
开发者ID:andrewisplinghoff,项目名称:bitsharesx,代码行数:39,代码来源:original_market_engine.cpp

示例3: mangle_new

struct MangleMask* mangle_new()
{
    struct MangleMask* self=NULL;

    self = calloc(1, sizeof(struct MangleMask));
    if (self == NULL) {
        wlog("Failed to allocate MangleMask\n");
        return NULL;
    }

    mangle_clear(self);
    return self;
}
开发者ID:erykoff,项目名称:pymangle,代码行数:13,代码来源:mangle.c

示例4: catch

 database_api::~database_api()
 {
    try {
       if(_broadcast_changes_complete.valid())
       {
          _broadcast_changes_complete.cancel();
          _broadcast_changes_complete.wait();
       }
    } catch (const fc::exception& e)
    {
       wlog("${e}", ("e",e.to_detail_string()));
    }
 }
开发者ID:NaturalCoder,项目名称:graphene,代码行数:13,代码来源:api.cpp

示例5: ilog

 server::~server()
 {
    ilog( "waiting for block generation loop to exit" );
    try {
       my->_block_gen_loop_complete.cancel();
       my->_block_gen_loop_complete.wait();
    } 
    catch ( const fc::canceled_exception& e ){}
    catch ( const fc::exception& e )
    {
       wlog( "${e}", ("e",e.to_detail_string()) );
    }
 }
开发者ID:HackFisher,项目名称:bitshares_snapshot,代码行数:13,代码来源:kid_server.cpp

示例6: load_and_configure_chain_database

bts::blockchain::chain_database_ptr load_and_configure_chain_database(const fc::path& datadir,
                                                                      const boost::program_options::variables_map& option_variables)
{
  auto dns_chain = std::make_shared<bts::dns::dns_db>();
  dns_chain->set_transaction_validator(std::make_shared<bts::dns::p2p::p2p_transaction_validator>(dns_chain.get()));
  bts::blockchain::chain_database_ptr chain = dns_chain;
  chain->open( datadir / "chain", true );
  if (option_variables.count("trustee-address"))
    chain->set_trustee(bts::blockchain::address(option_variables["trustee-address"].as<std::string>()));

  if (option_variables.count("genesis-json"))
  {
    if (chain->head_block_num() == trx_num::invalid_block_num)
    {
      fc::path genesis_json_file(option_variables["genesis-json"].as<std::string>());
      bts::blockchain::trx_block genesis_block;
      try
      {
        genesis_block = bts::net::create_test_genesis_block(genesis_json_file);
      }
      catch (fc::exception& e)
      {
        wlog("Error creating genesis block from file ${filename}: ${e}", ("filename", genesis_json_file)("e", e.to_string()));
        return chain;
      }
      try
      {
        chain->push_block(genesis_block);
      }
      catch ( const fc::exception& e )
      {
        wlog( "error pushing genesis block to blockchain database: ${e}", ("e", e.to_detail_string() ) );
      }
    }
    else
      wlog("Ignoring genesis-json command-line argument because our blockchain already has a genesis block");
  }
  return chain;
}
开发者ID:adbongo,项目名称:bitshares_toolkit,代码行数:39,代码来源:main.cpp

示例7: handle_message

        /* ===================================================== */   
        void handle_message( const connection_ptr& con, const message& m )
        { 
          try {
           chan_data& cdat = get_channel_data(con);
 
           ilog( "${msg_type}", ("msg_type", (bitname::message_type)m.msg_type ) );
           
           switch( (bitname::message_type)m.msg_type )
           {
               case name_inv_msg:
                 handle_name_inv( con, cdat, m.as<name_inv_message>() );
                 break;
               case block_inv_msg:
                 handle_block_inv( con, cdat, m.as<block_inv_message>() );
                 break;
               case get_name_inv_msg:
                 handle_get_name_inv( con, cdat, m.as<get_name_inv_message>() );
                 break;
               case get_headers_msg:
                 handle_get_headers( con, cdat, m.as<get_headers_message>() );
                 break;
               case get_block_msg:
                 handle_get_block( con, cdat, m.as<get_block_message>() );
                 break;
               case get_block_index_msg:
                 handle_get_block_index( con, cdat, m.as<get_block_index_message>() );
                 break;
               case get_name_header_msg:
                 handle_get_name( con, cdat, m.as<get_name_header_message>() );
                 break;
               case name_header_msg:
                 handle_name( con, cdat, m.as<name_header_message>() );
                 break;
               case block_index_msg:
                 handle_block_index( con, cdat, m.as<block_index_message>() );
                 break;
               case block_msg:
                 handle_block( con, cdat, m.as<block_message>() );
                 break;
               case headers_msg:
                 handle_headers( con, cdat, m.as<headers_message>() );
                 break;
               default:
                 FC_THROW_EXCEPTION( exception, "unknown bitname message type ${msg_type}", ("msg_type", m.msg_type ) );
           }
          } 
          catch ( fc::exception& e )
          {
            wlog( "${e}  ${from}", ("e",e.to_detail_string())("from",con->remote_endpoint()) );
          }
        }  // handle_message
开发者ID:1manStartup,项目名称:BitShares,代码行数:52,代码来源:bitname_channel.cpp

示例8: read_loop

 void read_loop() {
    while( !m_done ) {
      tornet::rpc::message msg;
      tornet::rpc::raw::unpack(udt_chan,msg);
      switch( msg.type ) {
        case message::notice: self.handle_notice(msg); break;
        case message::call:   self.handle_call(msg);   break;
        case message::result: self.handle_result(msg); break;
        case message::error:  self.handle_error(msg);  break;
        default: 
          wlog( "invalid message type %1%", int( msg.type ) );
      };
    }
 }
开发者ID:Zhang-Yi,项目名称:tornet,代码行数:14,代码来源:udt_connection.cpp

示例9: files_attr

static void files_attr(xmpp_stanza_t *stanza) {
  int rc; /* Return code */

  rc = pthread_mutex_lock(&mutex);
  wsyserr(rc != 0, "pthread_mutex_lock");

  char *error_attr = xmpp_stanza_get_attribute(stanza, "error"); /* error attribute */
  wfatal(error_attr == NULL, "no error attribute in files stanza");

  if (strcmp(error_attr, "0") != 0) {
    wlog("Error in attributes: %s", error_attr);
    attributes.is_valid = -1;
  } else {
    char *type_attr = xmpp_stanza_get_attribute(stanza, "type"); /* type attribute */
    wfatal(type_attr == NULL, "no type attribute in files stanza");

    if (strcmp(type_attr, "directory") == 0) {
      attributes.is_valid = 1;
      attributes.type = DIR;
    } else if (strcmp(type_attr, "file") == 0) {
      attributes.is_valid = 1;
      attributes.type = REG;
    } else {
      werr("Unknown type: %s", type_attr);
      attributes.is_valid = -1;
    }

    char *size_attr = xmpp_stanza_get_attribute(stanza, "size"); /* size */
    if (size_attr == NULL) {
      werr("xmpp_stanza_get_attribute attribute = size (%s)", xmpp_stanza_get_attribute(stanza, "path"));
      attributes.size = 0;
    } else {
      char *endptr; /* strtol endptr */
      long int size = strtol(size_attr, &endptr, 10);
      if (*endptr != '\0') {
        werr("strtol error: str = %s, val = %ld", size_attr, size);
        attributes.size = 0;
      }
      attributes.size = size;
    }
  }

  signal_attr = true;

  rc = pthread_cond_signal(&cond);
  wsyserr(rc != 0, "pthread_cond_signal");

  rc = pthread_mutex_unlock(&mutex);
  wsyserr(rc != 0, "pthread_mutex_unlock");
}
开发者ID:RedPitaya,项目名称:wyliodrin-server,代码行数:50,代码来源:files.c

示例10: ilog

  void profile::open( const fc::path& profile_dir, const std::string& password )
  { try {
      ilog("opening profile: ${profile_dir}",("profile_dir",profile_dir));
      my->_profile_name = profile_dir.filename().generic_wstring();

      fc::create_directories( profile_dir );
      fc::create_directories( profile_dir / "addressbook" );
      fc::create_directories( profile_dir / "idents" );
      fc::create_directories( profile_dir / "mail" );
      fc::create_directories( profile_dir / "mail" / "inbox" );
      fc::create_directories( profile_dir / "mail" / "draft" );
      fc::create_directories( profile_dir / "mail" / "pending" );
      fc::create_directories( profile_dir / "mail" / "sent" );
      fc::create_directories( profile_dir / "chat" );
      fc::create_directories( profile_dir / "request" );
      fc::create_directories( profile_dir / "authorization" );

      ilog("loading master key file:" KEYHOTEE_MASTER_KEY_FILE);
      auto profile_cfg_key         = fc::sha512::hash( password.c_str(), password.size() );
      std::vector<char> stretched_seed_data;
      try {
        stretched_seed_data     = fc::aes_load( profile_dir / KEYHOTEE_MASTER_KEY_FILE, profile_cfg_key );
      }
      catch (fc::exception& /* e */)
      { //try to open legacy name for key file
        wlog("Could not open " KEYHOTEE_MASTER_KEY_FILE ", trying to open legacy key file (.strecthed_seed).");
        stretched_seed_data     = fc::aes_load( profile_dir / ".stretched_seed", profile_cfg_key );
      }

      ilog("opening profile databases");
      my->_keychain.set_seed( fc::raw::unpack<fc::sha512>(stretched_seed_data) );
      my->_addressbook->open( profile_dir / "addressbook", profile_cfg_key );
      my->_idents.open( profile_dir / "idents" );
      my->_inbox_db->open( profile_dir / "mail" / "inbox", profile_cfg_key );
      my->_draft_db->open( profile_dir / "mail" / "draft", profile_cfg_key );
      my->_pending_db->open( profile_dir / "mail" / "pending", profile_cfg_key );
      my->_sent_db->open( profile_dir / "mail" / "sent", profile_cfg_key );
      my->_chat_db->open( profile_dir / "chat", profile_cfg_key );
      my->_request_db->open( profile_dir / "request", profile_cfg_key );
      my->_auth_db->open( profile_dir / "authorization", profile_cfg_key );
      my->_last_sync_time.open( profile_dir / "mail" / "last_recv", true );
      if( *my->_last_sync_time == fc::time_point())
      {
          *my->_last_sync_time = fc::time_point::now() - fc::days(5);
          ilog("set last_sync_time to ${t}",("t",*my->_last_sync_time));
      }
      else
          ilog("loaded last_sync_time = ${t}",("t",*my->_last_sync_time));
    ilog("finished opening profile");
  } FC_RETHROW_EXCEPTIONS( warn, "", ("profile_dir",profile_dir) ) }
开发者ID:drltc,项目名称:BitShares,代码行数:50,代码来源:profile.cpp

示例11: catch

upnp_service::~upnp_service()
{
  try {
      my->done = true;
      my->upnp_thread.quit();
      my->map_port_complete.wait();
  } 
  catch ( const fc::canceled_exception& e )
  {} // expected
  catch ( const fc::exception& e )
  {
      wlog( "unexpected exception\n ${e}", ("e", e.to_detail_string() ) );
  }
}
开发者ID:bytemaster,项目名称:bitshares,代码行数:14,代码来源:upnp.cpp

示例12: ilog

 void connection::exec_sync_loop()
 {
     ilog( "exec sync loop" );
     my->exec_sync_loop_complete = fc::async( [=]() 
     {
       try {
        // ilog( "in exec sync loop" );
         while( !my->exec_sync_loop_complete.canceled() )
         {
            //ilog( "sync time ${t}", ("t",my->_sync_time) );
            auto itr = my->_mail_db->lower_bound( my->_sync_time );
            if( !itr.valid() )
            {
             ilog( "no valid message found" );
            }
            while( itr.valid() && !my->exec_sync_loop_complete.canceled() )
            {
               if( itr.key() > my->_sync_time )
               {
                  send( message( itr.value() ) );
                  my->_sync_time = itr.key();
               }
               ++itr;
            }
            fc::usleep( fc::seconds(15) );
         }
       } 
       catch ( const fc::exception& e )
       {
          wlog( "${e}", ("e", e.to_detail_string() ) );
       }
       catch ( ... )
       {
          wlog("other exeception" );
       }
     });
 }
开发者ID:ripplexiaoshan,项目名称:BitShares,代码行数:37,代码来源:mail_connection.cpp

示例13: catch

upnp_service::~upnp_service()
{
  try 
  {
      my->done = true;
      if( my->map_port_complete.valid() )
         my->map_port_complete.cancel_and_wait();
  } 
  catch ( const fc::canceled_exception& )
  {} // expected
  catch ( const fc::exception& e )
  {
      wlog( "unexpected exception\n ${e}", ("e", e.to_detail_string() ) );
  }
}
开发者ID:AlexChien,项目名称:bitshares,代码行数:15,代码来源:upnp.cpp

示例14: network_connect

/*********************************************************************
 return RET_NOK on error
 *********************************************************************/
ret_code_t network_connect(context_t * context, const char * hostname)
{
	IPaddress ip;
	TCPsocket socket;

	wlog(LOGUSER, "Trying to connect to %s:%d", hostname, PORT);

	if (SDLNet_Init() < 0)
	{
		werr(LOGUSER, "Can't init SDLNet: %s\n", SDLNet_GetError());
		return RET_NOK;
	}

	if (SDLNet_ResolveHost(&ip, hostname, PORT) < 0)
	{
		werr(LOGUSER, "Can't resolve %s:%d : %s\n", hostname, PORT,
				SDLNet_GetError());
		return RET_NOK;
	}

	if (!(socket = SDLNet_TCP_Open(&ip)))
	{
		werr(LOGUSER, "Can't connect to %s:%d : %s\n", hostname, PORT,
				SDLNet_GetError());
		return RET_NOK;
	}

	wlog(LOGUSER, "Connected to %s:%d", hostname, PORT);

	context_set_hostname(context, hostname);
	context_set_socket(context, socket);

	SDL_CreateThread(async_recv, "async_recv", (void*) context);

	return RET_OK;
}
开发者ID:Bob-Z,项目名称:World-of-Gnome,代码行数:39,代码来源:network_client.cpp

示例15: clean_name

std::string clean_name( const std::string& name )
{
   std::string result;
   const static std::string prefix = "graphene::chain::";
   const static std::string suffix = "_operation";
   // graphene::chain::.*_operation
   if(    (name.size() >= prefix.size() + suffix.size())
       && (name.substr( 0, prefix.size() ) == prefix)
       && (name.substr( name.size()-suffix.size(), suffix.size() ) == suffix )
     )
        return name.substr( prefix.size(), name.size() - prefix.size() - suffix.size() );

   wlog( "don't know how to clean name: ${name}", ("name", name) );
   return name;
}
开发者ID:8001800,项目名称:graphene,代码行数:15,代码来源:reflect_util.hpp


注:本文中的wlog函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。