Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 31, 2011, 9:09:23 PM (13 years ago)
Author:
landauf
Message:

Replaced COUT with orxout in network library. Tried to set levels and contexts in a more or less useful way, but not really optimized. Used contexts network, packets, and master_server.
Please use endl instead of \n in the future (@smerkli) ;)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/libraries/network/MasterServer.cc

    r8351 r8807  
    3838  helper_output_debug( ENetEvent *event, char *addrconv )
    3939  {
    40     COUT(4) << "A packet of length"
     40    orxout(verbose, context::master_server)
     41      << "A packet of length"
    4142      << event->packet->dataLength
    4243      << " containing "
     
    4546      << addrconv
    4647      << " on channel "
    47       << event->channelID << "\n";
     48      << event->channelID << endl;
    4849  }
    4950
     
    6667          + MSPROTO_SERVERLIST_ITEM_LEN + 2,1 );
    6768      if( !tosend )
    68       { COUT(2) << "Masterserver.cc: Memory allocation failed.\n";
     69      { orxout(internal_warning, context::master_server) << "Masterserver.cc: Memory allocation failed." << endl;
    6970        continue;
    7071      }
     
    108109  { /* check for bad parameters */
    109110    if( !event )
    110     { COUT(2) << "MasterServer::eventConnect: No event given.\n" ;
     111    { orxout(internal_warning, context::master_server) << "MasterServer::eventConnect: No event given." << endl;
    111112      return -1;
    112113    }
     
    117118
    118119    /* output debug info */
    119     COUT(4) << "A new client connected from "
     120    orxout(verbose, context::master_server) << "A new client connected from "
    120121      << addrconv
    121122      << " on port "
    122       << event->peer->address.port << "\n";
     123      << event->peer->address.port << endl;
    123124
    124125    /* store string form of address here */
     
    134135  { /* check for bad parameters */
    135136    if( !event )
    136     { COUT(2) << "No event given.\n";
     137    { orxout(internal_warning, context::master_server) << "No event given." << endl;
    137138      return -1;
    138139    }
    139140
    140141    /* output that the disconnect happened */
    141     COUT(4) << (char*)event->peer->data << " disconnected.\n";
     142    orxout(verbose, context::master_server) << (char*)event->peer->data << " disconnected." << endl;
    142143
    143144    /* create string from peer data */
     
    159160  { /* validate packet */
    160161    if( !event || !(event->packet) || !(event->peer) )
    161     { COUT(2) << "No complete event given.\n";
     162    { orxout(internal_warning, context::master_server) << "No complete event given." << endl;
    162163      return -1;
    163164    }
     
    182183       
    183184        /* tell people we did so */
    184         COUT(2) << "Added new server to list: " <<
    185           packet::ServerInformation( event ).getServerIP() << "\n";
     185        orxout(internal_info, context::master_server) << "Added new server to list: " <<
     186          packet::ServerInformation( event ).getServerIP() << endl;
    186187      }
    187188
     
    197198
    198199        /* tell the user */
    199         COUT(2) << "Removed server " << name << " from list.\n";
     200        orxout(internal_info, context::master_server) << "Removed server " << name << " from list." << endl;
    200201      }
    201202
     
    230231    if( event == NULL )
    231232    {
    232       COUT(1) << "Could not create ENetEvent structure, exiting.\n";
     233      orxout(user_error, context::master_server) << "Could not create ENetEvent structure, exiting." << endl;
    233234      exit( EXIT_FAILURE );
    234235    }
     
    263264    /***** INITIALIZE NETWORKING *****/
    264265    if( enet_initialize () != 0)
    265     { COUT(1) << "An error occurred while initializing ENet.\n";
     266    { orxout(user_error, context::master_server) << "An error occurred while initializing ENet." << endl;
    266267      exit( EXIT_FAILURE );
    267268    }
     
    285286    /* see if creation worked */
    286287    if( !this->server )
    287     { COUT(1) <<
    288         "An error occurred while trying to create an ENet server host.\n";
     288    { orxout(user_error, context::master_server) <<
     289        "An error occurred while trying to create an ENet server host." << endl;
    289290      exit( EXIT_FAILURE );
    290291    }
     
    294295
    295296    /* tell people we're now initialized */
    296     COUT(0) << "MasterServer initialized, waiting for connections.\n";
     297    orxout(internal_status, context::master_server) << "MasterServer initialized, waiting for connections." << endl;
    297298  }
    298299
Note: See TracChangeset for help on using the changeset viewer.