本文整理汇总了C++中LogCategory::spam方法的典型用法代码示例。如果您正苦于以下问题:C++ LogCategory::spam方法的具体用法?C++ LogCategory::spam怎么用?C++ LogCategory::spam使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LogCategory
的用法示例。
在下文中一共展示了LogCategory::spam方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handle_datagram
virtual void handle_datagram(Datagram &in_dg, DatagramIterator &dgi)
{
channel_t sender = dgi.read_uint64();
unsigned short msg_type = dgi.read_uint16();
switch(msg_type)
{
case DBSERVER_CREATE_STORED_OBJECT:
{
unsigned int context = dgi.read_uint32();
// Start response with generic header
Datagram resp;
resp.add_server_header(sender, m_control_channel, DBSERVER_CREATE_STORED_OBJECT_RESP);
resp.add_uint32(context);
// Get DistributedClass
unsigned short dc_id = dgi.read_uint16();
DCClass *dcc = gDCF->get_class(dc_id);
if(!dcc)
{
m_log->error() << "Invalid DCClass when creating object: #" << dc_id << std::endl;
resp.add_uint32(0);
send(resp);
return;
}
// Unpack fields to be passed to database
DatabaseObject dbo(dc_id);
unsigned short field_count = dgi.read_uint16();
m_log->spam() << "Unpacking fields..." << std::endl;
try
{
for(unsigned int i = 0; i < field_count; ++i)
{
unsigned short field_id = dgi.read_uint16();
DCField *field = dcc->get_field_by_index(field_id);
if(field)
{
if(field->is_db())
{
dgi.unpack_field(field, dbo.fields[field]);
}
else
{
std::string tmp;
dgi.unpack_field(field, tmp);
}
}
}
}
catch(std::exception &e)
{
m_log->error() << "Error while unpacking fields, msg may be truncated. e.what(): "
<< e.what() << std::endl;
resp.add_uint32(0);
send(resp);
return;
}
// Check for required fields, and populate with defaults
m_log->spam() << "Checking all required fields exist..." << std::endl;
for(int i = 0; i < dcc->get_num_inherited_fields(); ++i)
{
DCField *field = dcc->get_inherited_field(i);
if(field->is_required() && field->is_db() && !field->as_molecular_field())
{
if(dbo.fields.find(field) == dbo.fields.end())
{
if(!field->has_default_value())
{
m_log->error() << "Field " << field->get_name() << " missing when trying to create "
"object of type " << dcc->get_name();
resp.add_uint32(0);
send(resp);
return;
}
else
{
dbo.fields[field] = field->get_default_value();
}
}
}
}
// Create object in database
m_log->spam() << "Creating stored object..." << std::endl;
unsigned int do_id = m_db_engine->create_object(dbo);
if(do_id == 0 || do_id < m_min_id || do_id > m_max_id)
{
m_log->error() << "Ran out of DistributedObject ids while creating new object." << std::endl;
resp.add_uint32(0);
send(resp);
return;
}
m_log->spam() << "... created with ID: " << do_id << std::endl;
resp.add_uint32(do_id);
send(resp);
//.........这里部分代码省略.........