本文整理汇总了C++中LOGGER_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ LOGGER_ERROR函数的具体用法?C++ LOGGER_ERROR怎么用?C++ LOGGER_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOGGER_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FILE_SERVICE
bool ConfigManager::loadConfig( const ConstString & _fileGroup, const ConstString & _applicationPath )
{
InputStreamInterfacePtr applicationInputStream =
FILE_SERVICE(m_serviceProvider)->openInputFile( _fileGroup, _applicationPath, false );
if( applicationInputStream == nullptr )
{
LOGGER_ERROR(m_serviceProvider)("ConfigManager::loadConfig Invalid open application settings %s"
, _applicationPath.c_str()
);
return false;
}
if( IniUtil::loadIni( m_ini, applicationInputStream, m_serviceProvider ) == false )
{
LOGGER_ERROR(m_serviceProvider)("ConfigManager::loadConfig Invalid load application settings %s"
, _applicationPath.c_str()
);
return false;
}
return true;
}
示例2: write_out_stream
static void
write_out_stream (const char *filename, char *data) {
vmbuf_reset(&write_buffer);
vmbuf_sprintf(&write_buffer, "{ \"message\": \"%s|%s|", hostname, filename);
json_escape_str_vmb(&write_buffer, data);
vmbuf_strcpy(&write_buffer, "\" }");
vmbuf_chrcpy(&write_buffer, '\0');
if (write_to_file) {
if (0 > file_writer_write(&fw, vmbuf_data(&write_buffer), vmbuf_wlocpos(&write_buffer))) {
LOGGER_ERROR("%s", "failed write attempt on outfile| aborting to diagnose!");
abort();
}
return;
}
int threshold = INTERFACE_ONERROR_RETRY_THRESHOLD;
while (0 > post_to_interface(vmbuf_data(&write_buffer), vmbuf_wlocpos(&write_buffer)) && (0 < threshold--)) {
if (0 == post_to_interface(vmbuf_data(&write_buffer), vmbuf_wlocpos(&write_buffer))) {
LOGGER_ERROR("post failed to %s, issuing reattempt#%d", eserv.hostname, threshold);
--failure;
break;
}
}
}
示例3: LOGGER_ERROR
const RenderMaterialStage * RenderMaterialManager::createRenderStageGroup( const ConstString & _name, const RenderMaterialStage & _stage )
{
TMapRenderStage::const_iterator it_found = m_materialStageIndexer.find( _name );
if( it_found != m_materialStageIndexer.end() )
{
LOGGER_ERROR(m_serviceProvider)("RenderMaterialManager::createRenderStageGroup '%s' is already created"
, _name.c_str()
);
return nullptr;
}
const RenderMaterialStage * cache_stage = this->cacheStage( _stage );
if( cache_stage == nullptr )
{
LOGGER_ERROR( m_serviceProvider )("RenderMaterialManager::createRenderStageGroup '%s' invalid cache"
, _name.c_str()
);
return nullptr;
}
return cache_stage;
}
示例4: http_server_init
int http_server_init(struct http_server *server) {
/*
* one time global initializers
*/
if (0 > mime_types_init())
return LOGGER_ERROR("failed to initialize mime types"), -1;
if (0 > http_headers_init())
return LOGGER_ERROR("failed to initialize http headers"), -1;
/*
* idle connection handler
*/
server->idle_ctx = ribs_context_create(SMALL_STACK_SIZE, http_server_idle_handler);
server->idle_ctx->data.ptr = server;
/*
* context pool
*/
if (0 == server->stack_size || 0 == server->num_stacks) {
struct rlimit rlim;
if (0 > getrlimit(RLIMIT_STACK, &rlim))
return LOGGER_PERROR("getrlimit(RLIMIT_STACK)"), -1;
long total_mem = sysconf(_SC_PHYS_PAGES);
if (total_mem < 0)
return LOGGER_PERROR("sysconf"), -1;
total_mem *= getpagesize();
size_t num_ctx_in_one_map = total_mem / rlim.rlim_cur;
/* half of total mem to start with so we don't need to enable overcommit */
num_ctx_in_one_map >>= 1;
LOGGER_INFO("http server pool: initial=%zu, grow=%zu", num_ctx_in_one_map, num_ctx_in_one_map);
ctx_pool_init(&server->ctx_pool, num_ctx_in_one_map, num_ctx_in_one_map, rlim.rlim_cur, sizeof(struct http_server_context) + server->context_size);
} else {
示例5: msi_kill
int msi_kill(MSISession *session, Logger *log)
{
if (session == NULL) {
LOGGER_ERROR(log, "Tried to terminate non-existing session");
return -1;
}
m_callback_msi_packet((struct Messenger *) session->messenger, NULL, NULL);
if (pthread_mutex_trylock(session->mutex) != 0) {
LOGGER_ERROR(session->messenger->log, "Failed to aquire lock on msi mutex");
return -1;
}
if (session->calls) {
MSIMessage msg;
msg_init(&msg, requ_pop);
MSICall *it = get_call(session, session->calls_head);
while (it) {
send_message(session->messenger, it->friend_number, &msg);
MSICall *temp_it = it;
it = it->next;
kill_call(temp_it); /* This will eventually free session->calls */
}
}
pthread_mutex_unlock(session->mutex);
pthread_mutex_destroy(session->mutex);
LOGGER_DEBUG(session->messenger->log, "Terminated session: %p", session);
free(session);
return 0;
}
示例6: msi_hangup
int msi_hangup(MSICall *call)
{
if (!call || !call->session) {
return -1;
}
MSISession *session = call->session;
LOGGER_DEBUG(session->messenger->log, "Session: %p Hanging up call with friend: %u", call->session,
call->friend_number);
if (pthread_mutex_trylock(session->mutex) != 0) {
LOGGER_ERROR(session->messenger->log, "Failed to aquire lock on msi mutex");
return -1;
}
if (call->state == msi_CallInactive) {
LOGGER_ERROR(session->messenger->log, "Call is in invalid state!");
pthread_mutex_unlock(session->mutex);
return -1;
}
MSIMessage msg;
msg_init(&msg, requ_pop);
send_message(session->messenger, call->friend_number, &msg);
kill_call(call);
pthread_mutex_unlock(session->mutex);
return 0;
}
示例7: toxav_kill_transmission
/**
* @brief Call this at the end of the transmission.
*
* @param av Handler.
* @return int
* @retval 0 Success.
* @retval ToxAvError On error.
*/
int toxav_kill_transmission ( ToxAv *av, int32_t call_index )
{
if (cii(call_index, av->msi_session)) return ErrorNoCall;
CallSpecific *call = &av->calls[call_index];
if ( call->crtps[audio_index] && -1 == rtp_terminate_session(call->crtps[audio_index], av->messenger) ) {
LOGGER_ERROR("Error while terminating audio RTP session!\n");
return ErrorTerminatingAudioRtp;
}
if ( call->crtps[video_index] && -1 == rtp_terminate_session(call->crtps[video_index], av->messenger) ) {
LOGGER_ERROR("Error while terminating video RTP session!\n");
return ErrorTerminatingVideoRtp;
}
call->crtps[audio_index] = NULL;
call->crtps[video_index] = NULL;
if ( call->j_buf ) {
terminate_queue(call->j_buf);
call->j_buf = NULL;
LOGGER_DEBUG("Terminated j queue");
} else LOGGER_DEBUG("No j queue");
if ( call->cs ) {
codec_terminate_session(call->cs);
call->cs = NULL;
LOGGER_DEBUG("Terminated codec session");
} else LOGGER_DEBUG("No codec session");
return ErrorNone;
}
示例8: init_audio_encoder
static int init_audio_encoder(CSSession *cs)
{
int rc = OPUS_OK;
cs->audio_encoder = opus_encoder_create(cs->audio_encoder_sample_rate,
cs->audio_encoder_channels, OPUS_APPLICATION_AUDIO, &rc);
if ( rc != OPUS_OK ) {
LOGGER_ERROR("Error while starting audio encoder: %s", opus_strerror(rc));
return -1;
}
rc = opus_encoder_ctl(cs->audio_encoder, OPUS_SET_BITRATE(cs->audio_encoder_bitrate));
if ( rc != OPUS_OK ) {
LOGGER_ERROR("Error while setting encoder ctl: %s", opus_strerror(rc));
return -1;
}
rc = opus_encoder_ctl(cs->audio_encoder, OPUS_SET_COMPLEXITY(10));
if ( rc != OPUS_OK ) {
LOGGER_ERROR("Error while setting encoder ctl: %s", opus_strerror(rc));
return -1;
}
return 0;
}
示例9: FILE_SERVICE
ParticleEmitterContainerInterface2Ptr ParticleEngine2::createEmitterContainerFromFile( const ConstString& _fileGroupName, const FilePath & _fileName )
{
if( m_available == false )
{
return nullptr;
}
InputStreamInterfacePtr stream = FILE_SERVICE(m_serviceProvider)
->openInputFile( _fileGroupName, _fileName, false );
if( stream == nullptr )
{
LOGGER_ERROR(m_serviceProvider)("ParticleEngine2::createEmitterContainerFromFile can't open file %s:%s"
, _fileGroupName.c_str()
, _fileName.c_str()
);
return nullptr;
}
ParticleEmitterContainerInterface2Ptr container = PARTICLE_SYSTEM2(m_serviceProvider)
->createEmitterContainerFromMemory( stream, m_archivator );
if( container == nullptr )
{
LOGGER_ERROR(m_serviceProvider)("ParticleEngine2::createEmitterContainerFromFile can't create emitter container '%s'"
, _fileName.c_str()
);
return nullptr;
}
return container;
}
示例10: LOGGER_ERROR
AccountInterfacePtr AccountManager::loadAccount_( const WString& _accountID )
{
AccountInterfacePtr account = this->newAccount_( _accountID );
if( account == nullptr )
{
LOGGER_ERROR(m_serviceProvider)("AccountManager::loadAccount_ invalid create account %ls"
, _accountID.c_str()
);
return nullptr;
}
if( m_accountProvider != nullptr )
{
m_currentAccount = account;
m_accountProvider->onCreateAccount( _accountID );
m_currentAccount = nullptr;
}
if( account->load() == false )
{
LOGGER_ERROR(m_serviceProvider)("AccountManager::loadAccount_ invalid load account %ls"
, _accountID.c_str()
);
return nullptr;
}
return account;
}
示例11: LOGGER_ERROR
bool SDLFileInputStream::openFile_( const FilePath & _folder, const FilePath & _fileName, Char * _filePath )
{
if( SDLLAYER_SERVICE(m_serviceProvider)
->concatenateFilePath( _folder, _fileName, _filePath, MENGINE_MAX_PATH ) == false )
{
LOGGER_ERROR(m_serviceProvider)("SDLFileInputStream::open invlalid concatenate filePath '%s':'%s'"
, _folder.c_str()
, _fileName.c_str()
);
return false;
}
m_rwops = SDL_RWFromFile(_filePath, "rb");
if ( m_rwops == nullptr )
{
LOGGER_ERROR(m_serviceProvider)("SDLFileInputStream::open %s invalid open"
, _filePath
);
return false;
}
# ifdef _DEBUG
if( SERVICE_EXIST( m_serviceProvider, NotificationServiceInterface ) == true )
{
NOTIFICATION_SERVICE( m_serviceProvider )
->notify( NOTIFICATOR_DEBUG_OPEN_FILE, _folder.c_str(), _fileName.c_str() );
}
# endif
return true;
}
示例12: ribs_ssl_set_options
int ribs_ssl_set_options(SSL_CTX *ssl_ctx, char *cipher_list) {
/* bugs */
SSL_CTX_set_options(ssl_ctx, SSL_OP_ALL); /* almost all bugs */
SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv2); /* disable SSLv2 per RFC 6176 */
SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SSLv3); /* disable SSLv3. goodbye IE6 */
SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_COMPRESSION);
SSL_CTX_set_options(ssl_ctx, SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION);
/* ciphers */
if (!cipher_list)
cipher_list = _HTTP_SERVER_SSL_CIPHERS;
SSL_CTX_set_options(ssl_ctx, SSL_OP_CIPHER_SERVER_PREFERENCE);
if (0 == SSL_CTX_set_cipher_list(ssl_ctx, cipher_list))
return LOGGER_ERROR("failed to initialize SSL:cipher_list"), -1;
/* DH 2048 bits */
SSL_CTX_set_options(ssl_ctx, SSL_OP_SINGLE_DH_USE);
DH *dh = DH_new();
dh->p = get_rfc3526_prime_2048(NULL);
BN_dec2bn(&dh->g, "2");
if (0 == SSL_CTX_set_tmp_dh(ssl_ctx, dh))
return LOGGER_ERROR("failed to initialize SSL:dh"), -1;
DH_free(dh);
/* Ecliptic Curve DH */
SSL_CTX_set_options(ssl_ctx, SSL_OP_SINGLE_ECDH_USE);
EC_KEY *ecdh = EC_KEY_new_by_curve_name(OBJ_sn2nid("prime256v1"));
if (ecdh == NULL)
return LOGGER_ERROR("failed to initialize SSL:edch"), -1;
SSL_CTX_set_tmp_ecdh(ssl_ctx, ecdh);
EC_KEY_free(ecdh);
return 0;
}
示例13: LOGGER_ERROR
MSISession *msi_new(Messenger *m)
{
if (m == NULL) {
return NULL;
}
MSISession *retu = (MSISession *)calloc(sizeof(MSISession), 1);
if (retu == NULL) {
LOGGER_ERROR(m->log, "Allocation failed! Program might misbehave!");
return NULL;
}
if (create_recursive_mutex(retu->mutex) != 0) {
LOGGER_ERROR(m->log, "Failed to init mutex! Program might misbehave");
free(retu);
return NULL;
}
retu->messenger = m;
m_callback_msi_packet(m, handle_msi_packet, retu);
/* This is called when remote terminates session */
m_callback_connectionstatus_internal_av(m, on_peer_status, retu);
LOGGER_DEBUG(m->log, "New msi session: %p ", retu);
return retu;
}
示例14: msi_change_capabilities
int msi_change_capabilities(MSICall *call, uint8_t capabilities)
{
if (!call || !call->session) {
return -1;
}
MSISession *session = call->session;
LOGGER_DEBUG(session->messenger->log, "Session: %p Trying to change capabilities to friend %u", call->session,
call->friend_number);
if (pthread_mutex_trylock(session->mutex) != 0) {
LOGGER_ERROR(session->messenger->log, "Failed to aquire lock on msi mutex");
return -1;
}
if (call->state != msi_CallActive) {
LOGGER_ERROR(session->messenger->log, "Call is in invalid state!");
pthread_mutex_unlock(session->mutex);
return -1;
}
call->self_capabilities = capabilities;
MSIMessage msg;
msg_init(&msg, requ_push);
msg.capabilities.exists = true;
msg.capabilities.value = capabilities;
send_message(call->session->messenger, call->friend_number, &msg);
pthread_mutex_unlock(session->mutex);
return 0;
}
示例15: LOGGER_ERROR
bool CSocker::createSocket(SOCKET sock)
{
if( m_socket != INVALID_SOCKET )
{
LOGGER_ERROR("create socket failed: socket not invalid %d", m_socket);
return false;
}
m_socket = sock != INVALID_SOCKET ? sock : SocketOps::CreateTCPFileDescriptor();
if( m_socket == INVALID_SOCKET )
{
LOGGER_ERROR("create socket failed:%d", SocketOps::GetLastError());
return false;
}
if( !SocketOps::SetGracefulClose(m_socket) )
{
LOGGER_ERROR("SocketOps::SetGracefulClose error:%d, socket=%d", SocketOps::GetLastError(), m_socket);
return false;
}
m_status = Key_Work;
return true;
}