本文整理汇总了C++中LOG_PRINT函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_PRINT函数的具体用法?C++ LOG_PRINT怎么用?C++ LOG_PRINT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LOG_PRINT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LOG_PRINT
bool demo_http_server::run() {
//here you can set worker threads count
int thrds_count = 4;
//go to loop
LOG_PRINT("Run net_service loop( " << thrds_count << " threads)...",
LOG_LEVEL_0);
if (!m_net_server.run_server(thrds_count)) {
LOG_ERROR("Failed to run net tcp server!");
}
LOG_PRINT("net_service loop stopped.", LOG_LEVEL_0);
return true;
}
示例2: register_lua_function
// type is 0 for energy, 1 for gradient
void register_lua_function(char *plugin_function_name, LUA_FUNCTION_TYPE type)
{
LOG_PRINT(LOG_INFO,"Registering Lua function : %s \n",plugin_function_name);
if(type == POTENTIAL)
strcpy(lua_function[POTENTIAL],plugin_function_name);
else if(type == GRADIENT)
strcpy(lua_function[GRADIENT],plugin_function_name);
else
{
LOG_PRINT(LOG_ERROR,"Unknown type %d for register_lua_function.\n",type);
exit(-1);
}
}
示例3: log_hexdump_line
void log_hexdump_line(struct log_handle *l) {
if (!l)
return;
assert(l->prefix != NULL);
assert(l->type == LOG_HEXDUMP);
if (l->ctx.hexdump.nbytes == 0)
return;
LOG_PRINT("%s: %04x ", l->prefix, l->ctx.hexdump.address);
unsigned i;
for (i = 0; i < l->ctx.hexdump.nbytes; i++) {
int f = ((i + 1) == l->ctx.hexdump.flag) ? '*' : ' ';
LOG_PRINT("%02x%c", l->ctx.hexdump.buf[i], f);
if (i == 8)
LOG_PRINT(" ");
}
for (; i < 16; i++) {
LOG_PRINT(" ");
if (i == 8)
LOG_PRINT(" ");
}
LOG_PRINT(" |");
for (i = 0; i < l->ctx.hexdump.nbytes; i++) {
int c = l->ctx.hexdump.buf[i];
LOG_PRINT("%c", isprint(c) ? c : (int)'.');
}
LOG_PRINT("|\n");
l->ctx.hexdump.address += l->ctx.hexdump.nbytes;
l->ctx.hexdump.nbytes = 0;
l->ctx.hexdump.flag = -1;
}
示例4: get_pkcs7_from_pem
static PKCS7*
get_pkcs7_from_pem(const char* enc_entity)
{
const char* p;
char* wrapped_enc_entity = NULL;
BIO* rbio = NULL;
PKCS7* p7 = NULL;
/* Check if encrypted entity is composed of raw data or if it has some
* headers. In the latter case, just skip the headers. Headers are
* separated from data by an empty line (hence sequence CRLF CRLF).*/
if (p = strstr(enc_entity, CRLF CRLF)) {
enc_entity = p+4;
} else if (p = strstr(enc_entity, LF LF)) {
enc_entity = p+2;
} else if (p = strstr(enc_entity, CR CR)) {
enc_entity = p+2;
}
/* Make sure the pem markers are there */
LOG_PRINT("get_pkcs7_from_pem: wrapping in pem markers");
if (!(wrapped_enc_entity = wrap_in_pem_markers(enc_entity, "PKCS7")))
GOTO_ERR("no memory?");
LOG_PRINT("get_pkcs7_from_pem: wrapped.");
/* Set up BIO so encrypted/signed data can be read from pem file */
if (!(rbio = set_read_BIO_from_buf(wrapped_enc_entity, -1))) goto err;
LOG_PRINT("get_pkcs7_from_pem: ready to read PKCS7 bio...");
/* Load the PKCS7 object from a pem file to internal representation.
* this reads all of the data file. */
if (!(p7=PEM_read_bio_PKCS7(rbio,NULL/*&x*/,NULL/*callback*/,NULL/*arg*/)))
GOTO_ERR("11 corrupt PEM PKCS7 file? (PEM_read_bio_PKCS7)");
LOG_PRINT("get_pkcs7_from_pem: bio read");
BIO_free_all(rbio);
Free(wrapped_enc_entity);
return p7;
err:
if (rbio) BIO_free_all(rbio);
if (wrapped_enc_entity) Free(wrapped_enc_entity);
return NULL;
}
示例5: LOG_PRINT
void alarms_history::on_comboBoxLevel_currentIndexChanged(int index)
{
LOG_PRINT(info_e, "_level %d\n", _level);
/* 0 is all level */
if (_level != index && index < nb_of_level_e)
{
_level = index;
LOG_PRINT(info_e, "_level %d\n", _level);
if (_file_nb == 0) return;
if (loadLogFile(_current, _alarm, _event, _level) == false)
{
LOG_PRINT(error_e, "Cannot open log file %d\n", _current);
}
}
}
示例6: LOG_PRINT
void Acceptor::listen()
{
socket_t fd = SocketOps::createSocket();
if(fd < 0)
{
LOG_PRINT(LogType_Fatal, "create socket failed:%s %s:%d",
GetLastErrorText().c_str(), __FUNCTION__, __LINE__);
return;
}
if(!SocketOps::bindSocket(fd, &listenAddr_.getSockAddr()))
{
LOG_PRINT(LogType_Fatal, "bind socket failed:%s %s:%d",
GetLastErrorText().c_str(), __FUNCTION__, __LINE__);
goto err;
}
if(!SocketOps::listen(fd))
{
LOG_PRINT(LogType_Fatal, "listen socket failed:%s %s:%d",
GetLastErrorText().c_str(), __FUNCTION__, __LINE__);
goto err;
}
if(!SocketOps::setSocketNoneBlocking(fd))
{
LOG_PRINT(LogType_Fatal, "enable socket noneBlocking failed:%s %s:%d",
GetLastErrorText().c_str(), __FUNCTION__, __LINE__);
goto err;
}
LOG_PRINT(LogType_Info, "Acceptor listen at ip:%s port:%u", listenAddr_.ip().c_str(),
listenAddr_.port());
listenFd_ = fd;
acceptChannelPtr_ = std::make_shared<Channel>(loop_, listenFd_);
acceptChannelPtr_->setReadCallback(std::bind(&Acceptor::handleRead, this));
acceptChannelPtr_->setOwner(shared_from_this());
acceptChannelPtr_->enableReading();
listenning_ = true;
return;
err:
SocketOps::closeSocket(fd);
return;
}
示例7: timeGetTime
/*
*************************
Stops measuring the time
*************************
*/
void DebugApi::Stop ()
{
unsigned long mElapsedTime = mTime - timeGetTime();
if (mElapsedTime < 0) mElapsedTime = 0;
mElapsedTime = mElapsedTime * (unsigned long) 0.001f;
LOG_PRINT(" %d\n", mElapsedTime);
}
示例8: signal
/*
*************************
Writes a signal (for debugging purposes)
*************************
*/
void DebugApi::BreakPoint ()
{
if (!mOk) return;
LOG_PRINT("Abracadabra\n");
}
示例9: switch
/**
* make clone frame.
* always make copy buffer on it.
* @param prev_frame reuse frame object.
* @param src_frame source of clone.
*/
ttLibC_Video *ttLibC_Video_clone(
ttLibC_Video *prev_frame,
ttLibC_Video *src_frame) {
if(src_frame == NULL) {
return NULL;
}
switch(src_frame->inherit_super.type) {
// case frameType_bgr:
case frameType_flv1:
return (ttLibC_Video *)ttLibC_Flv1_clone(
(ttLibC_Flv1 *)prev_frame,
(ttLibC_Flv1 *)src_frame);
case frameType_h264:
return (ttLibC_Video *)ttLibC_H264_clone(
(ttLibC_H264 *)prev_frame,
(ttLibC_H264 *)src_frame);
// case frameType_h265:
// case frameType_theora:
// case frameType_vp6:
// case frameType_vp8:
// case frameType_vp9:
// case frameType_wmv1:
// case frameType_wmv2:
// case frameType_yuv420:
default:
LOG_PRINT("no clone function, frame type:%d", src_frame->inherit_super.type);
return NULL;
}
}
示例10: mk_dirs
/**
* @brief mk_dirs It creates a multi-level directory like ./img/330/28/557.
*
* @param dir The path of a multi-level directory.
*
* @return 1 for success and -1 for fail.
*/
int mk_dirs(const char *dir)
{
char tmp[512];
char *p;
if (strlen(dir) == 0 || dir == NULL)
{
LOG_PRINT(LOG_WARNING, "strlen(dir) is 0 or dir is NULL.");
return -1;
}
memset(tmp, 0, sizeof(tmp));
strncpy(tmp, dir, strlen(dir));
if (tmp[0] == '/' && tmp[1]== '/')
p = strchr(tmp + 2, '/');
else
p = strchr(tmp, '/');
if (p)
{
*p = '\0';
mkdir(tmp,0777);
chdir(tmp);
}
else
{
mkdir(tmp,0777);
chdir(tmp);
return 1;
}
mk_dirs(p + 1);
return 1;
}
示例11: is_dir
/**
* @brief is_dir Check a path is a directory.
*
* @param path The path input.
*
* @return 1 for yes and -1 for no.
*/
int is_dir(const char *path)
{
struct stat st;
if(stat(path, &st)<0)
{
LOG_PRINT(LOG_WARNING, "Path[%s] is Not Existed!", path);
return -1;
}
if(S_ISDIR(st.st_mode))
{
LOG_PRINT(LOG_INFO, "Path[%s] is A Dir.", path);
return 1;
}
else
return -1;
}
示例12: rb_new
//buffern len is the number of pointers we want allocate, the ptr size is the maximum size of each ptr.
ring_t*
rb_new(uint32_t buffer_len)
{
ring_t * rb;
rb = (ring_t*)malloc(sizeof(ring_t));
if (!rb)
return NULL;
LOG_PRINT("\nRing buffer is being created with the size %d.", buffer_len);
rb->size = buffer_len;
rb->buffer_start = (uint8_t*)malloc(rb->size * sizeof *rb->buffer_start);
memset(rb->buffer_start, 0, rb->size);
rb->buffer_end = (rb->buffer_start + (rb->size ) );
rb->write_calls = 0;
rb->read_calls = 0;
rb->head = rb->buffer_start;
rb->tail = rb->buffer_end;
rb->round_complete = 0;
return rb;
}
示例13: if
void MainState::Update() {
// Moves the player in the specified direction
if (m_PlayerDirState[kPlayerDirLeft]) {
m_Player->TranslateBy(Vec2(-5.0, 0.0));
}
else if (m_PlayerDirState[kPlayerDirRight]) {
m_Player->TranslateBy(Vec2(5.0, 0.0));
}
else if (m_PlayerDirState[kPlayerDirUp]) {
m_Player->TranslateBy(Vec2(0.0, -5.0));
}
else if (m_PlayerDirState[kPlayerDirDown]) {
m_Player->TranslateBy(Vec2(0.0, 5.0));
}
for (int i = 0; i < m_ProjectileArray.GetSize(); ++i) {
Rect screenRect = m_EnginePtr->GetScene()->GetScreenRect();
Projectile* projectile = m_ProjectileArray[i];
Vec2 pos = projectile->GetWorldPosition();
if (pos.GetX() < screenRect.GetX() ||
pos.GetX() > (screenRect.GetX() + screenRect.GetW()) ||
pos.GetY() < screenRect.GetY() ||
pos.GetY() > (screenRect.GetY() + screenRect.GetH())) {
LOG_PRINT("removed");
}
}
}
示例14: event_unregister_poll
static int
event_unregister_poll (struct event_pool *event_pool, int fd, int idx_hint)
{
int idx = -1;
GF_VALIDATE_OR_GOTO ("event", event_pool, out);
pthread_mutex_lock (&event_pool->mutex);
{
idx = __event_getindex (event_pool, fd, idx_hint);
if (idx == -1) {
LOG_PRINT(D_LOG_ERR,
"index not found for fd=%d (idx_hint=%d)",
fd, idx_hint);
errno = ENOENT;
goto unlock;
}
event_pool->reg[idx] = event_pool->reg[--event_pool->used];
event_pool->changed = 1;
}
unlock:
pthread_mutex_unlock (&event_pool->mutex);
out:
return idx;
}
示例15: if
inline BaseEntity *EntityManager::GetBaseEntity( BaseEntityHandle& rBaseEntityHandle )
{
BaseEntity *pBaseEntity = NULL;
if( rBaseEntityHandle.GetBaseEntityPointer() )
{
// already loaded
pBaseEntity = rBaseEntityHandle.GetBaseEntityPointer();
}
else if( rBaseEntityHandle.GetState() == BaseEntityHandle::STATE_INVALID )
{
// invalid base entity handle
// - already tried to load the base entity before but it was not found in the database
return NULL;
}
else // i.e. rBaseEntityHandle.GetState() == BaseEntityHandle::STATE_UNINITIALIZED
{
// get pointer to the base entity
// if the base entity has not been loaded yet, load it
if( LoadBaseEntity( rBaseEntityHandle ) )
{
pBaseEntity = rBaseEntityHandle.GetBaseEntityPointer();
}
else
{
LOG_PRINT( " - unable to create a copy entity (base entity: " + string(rBaseEntityHandle.GetBaseEntityName()) + ")" );
return NULL;
}
}
return pBaseEntity;
}