本文整理汇总了C++中LogWarn函数的典型用法代码示例。如果您正苦于以下问题:C++ LogWarn函数的具体用法?C++ LogWarn怎么用?C++ LogWarn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了LogWarn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LogWarn
void visual_system_impl::init_eye()
{
// no eye is selected if camera name is incorrect to show problem visually!!!
// please don't change selection logic
#if 0
eye_ = (!props_.channel.camera_name.empty())
? find_object<visual_control_ptr>(this, props_.channel.camera_name)
: find_first_object<visual_control_ptr>(this) ;
if (!eye_ && !props_.channel.camera_name.empty())
LogWarn("Can't find camera: " << props_.channel.camera_name);
#else
eye_ = find_object<visual_control_ptr>(this, props_.channel.camera_name);
if (!eye_ && !props_.channel.camera_name.empty())
LogWarn("Can't find camera: " << props_.channel.camera_name);
if(!eye_)
eye_ = find_first_object<visual_control_ptr>(this) ;
#endif
#if 0
viewport_->SetClarityScale(props_.channel.pixel_scale);
viewport_->set_geom_corr(props_.channel.cylindric_geom_corr ? victory::IViewport::explicit_cylinder : victory::IViewport::no_geom_corr);
init_frustum_projection();
#endif
update_eye();
}
示例2: pthread_win32_thread_attach_np
void *Thread::ThreadRun(void *myThread)
{
Thread *thread = reinterpret_cast<Thread*>(myThread);
thread->mRunning = true;
#ifdef PTW32_STATIC_LIB
pthread_win32_thread_attach_np();
#endif
try {
thread->mTask->run();
}
catch(const std::exception &e)
{
LogWarn("Thread::ThreadRun", String("Unhandled exception in thread: ") + e.what());
}
catch(...)
{
LogWarn("Thread::ThreadRun", String("Unhandled unknown exception in thread"));
}
thread->mRunning = false;
if(thread->mAutoDelete) delete thread;
#ifdef PTW32_STATIC_LIB
pthread_win32_thread_detach_np();
#endif
pthread_exit(NULL);
return NULL;
}
示例3: setup_server_sockets
int setup_server_sockets(struct srv_sock_info ssi[])
{
int i=0;
ssi[0].sd = ssi[1].sd = -1;
// Only enqueue sockets successfully bound or that weren't disabled.
if (tcsd_options.disable_ipv4) {
LogWarn("IPv4 support disabled by configuration option");
} else {
if (setup_ipv4_socket(&ssi[i]) == 0)
i++;
}
if (tcsd_options.disable_ipv6) {
LogWarn("IPv6 support disabled by configuration option");
} else {
setup_ipv6_socket(&ssi[i]);
}
// It's only a failure if both sockets are unavailable.
if ((ssi[0].sd == -1) && (ssi[1].sd == -1)) {
return -1;
}
return 0;
}
示例4: LogInfo
void ImageExport::processExport(){
exportQueued_ = false;
auto image = imagePort_.getData();
if (image && !imageFile_.get().empty()) {
const Layer* layer = image->getColorLayer();
if (layer){
std::string fileExtension = filesystem::getFileExtension(imageFile_.get());
auto writer =
DataWriterFactory::getPtr()->getWriterForTypeAndExtension<Layer>(fileExtension);
if (writer) {
try {
writer->setOverwrite(overwrite_.get());
writer->writeData(layer, imageFile_.get());
LogInfo("Image color layer exported to disk: " << imageFile_.get());
} catch (DataWriterException const& e) {
util::log(e.getContext(), e.getMessage(), LogLevel::Error);
}
} else {
LogError("Error: Could not find a writer for the specified extension and data type");
}
}
else {
LogError("Error: Could not find color layer to write out");
}
} else if (imageFile_.get().empty()) {
LogWarn("Error: Please specify a file to write to");
} else if (!image) {
LogWarn("Error: Please connect an image to export");
}
}
示例5: LogDebug
bool VidscaleSHMIntf::removeRabRecordInSharedMemory(umtsRab *pRabObject)
{
bool retVal = true;
LogDebug("removeTunnelInSharedMemory\n");
if(!(deleteSHMHashEntry((char*)(&(pRabObject->upTeidKey)), SHM_KEY_TUN, pRabObject->imsi)))
{
LogWarn("UPTEID - Old Session deletion failed \n");
retVal = false;
}
else
{
LogInfo("UPTEID - delete entry successful\n");
}
if(!(deleteSHMHashEntry((char*)(&(pRabObject->downTeidKey)), SHM_KEY_TUN, pRabObject->imsi)))
{
LogWarn("DOWN TEID -Old Session deletion failed \n");
retVal = false;
}
else
{
LogInfo("DOWNTEID - delete entry successful\n");
}
phashValueFreeMemMgrObj->pushFreeMem(pRabObject , (pRabObject->imsi%MAX_CONTROLLING_ENTITIES));
return retVal;
}
示例6: LogInfo
void VolumeExport::exportVolume() {
auto volume = volumePort_.getData();
if (volume && !volumeFile_.get().empty()) {
std::string fileExtension = filesystem::getFileExtension(volumeFile_.get());
auto writer =
DataWriterFactory::getPtr()->getWriterForTypeAndExtension<Volume>(fileExtension);
if (writer) {
try {
writer->setOverwrite(overwrite_.get());
writer->writeData(volume.get(), volumeFile_.get());
LogInfo("Volume exported to disk: " << volumeFile_.get());
} catch (DataWriterException const& e) {
util::log(e.getContext(), e.getMessage(), LogLevel::Error);
}
} else {
LogError("Error: Cound not find a writer for the specified extension and data type");
}
} else if (volumeFile_.get().empty()) {
LogWarn("Error: Please specify a file to write to");
} else if (!volume) {
LogWarn("Error: Please connect a volume to export");
}
}
示例7: alcMakeContextCurrent
Utils::Ticket<AudioWorld> AudioWorld::playSound(Handle::SfxHandle h, const Math::float3& position, bool relative, float maxDist)
{
#ifdef RE_USE_SOUND
if (!m_Context)
return Utils::Ticket<AudioWorld>();
alcMakeContextCurrent(m_Context);
Sound& snd = m_Allocator.getElement(h);
// Get a cached source object
Source s = getFreeSource();
//LogInfo() << "play sound " << snd.sfx.file << " vol " << snd.sfx.vol;
alSourcef(s.m_Handle, AL_PITCH, m_Engine.getGameClock().getGameEngineSpeedFactor());
alSourcef(s.m_Handle, AL_GAIN, snd.sfx.vol / 127.0f);
alSource3f(s.m_Handle, AL_POSITION, position.x, position.y, position.z);
alSource3f(s.m_Handle, AL_VELOCITY, 0, 0, 0);
alSourcef(s.m_Handle, AL_MAX_DISTANCE, maxDist);
// Relative for sources directly attached to the listener
alSourcei(s.m_Handle, AL_SOURCE_RELATIVE, relative ? AL_TRUE : AL_FALSE);
// TODO: proper looping would require slicing and queueing multiple buffers
// and setting the source to loop when the non-looping buffer was played.
// start and end don't seem to be used, thoug?
alSourcei(s.m_Handle, AL_LOOPING, snd.sfx.loop ? AL_TRUE : AL_FALSE);
alSourcei(s.m_Handle, AL_BUFFER, snd.m_Handle);
ALenum error = alGetError();
if (error != AL_NO_ERROR)
{
static bool warned = false;
if (!warned)
{
LogWarn() << "Could not attach buffer to source: " << AudioEngine::getErrorString(error);
warned = true;
}
return Utils::Ticket<AudioWorld>();
}
alSourcePlay(s.m_Handle);
error = alGetError();
if (error != AL_NO_ERROR)
{
static bool warned = false;
if (!warned)
{
LogWarn() << "Could not start source!" << AudioEngine::getErrorString(error);
warned = true;
}
return Utils::Ticket<AudioWorld>();
}
return s.soundTicket;
#else
return Utils::Ticket<AudioWorld>();
#endif
}
示例8: setup_ipv6_socket
int setup_ipv6_socket(struct srv_sock_info *ssi)
{
struct sockaddr_in6 serv6_addr;
int sd6, opt;
ssi->sd = -1;
sd6 = socket(AF_INET6, SOCK_STREAM, 0);
if (sd6 < 0) {
LogWarn("Failed IPv6 socket: %s", strerror(errno));
goto err;
}
memset(&serv6_addr, 0, sizeof (serv6_addr));
serv6_addr.sin6_family = AF_INET6;
serv6_addr.sin6_port = htons(tcsd_options.port);
/* If no remote_ops are defined, restrict connections to localhost
* only at the socket. */
if (tcsd_options.remote_ops[0] == 0)
serv6_addr.sin6_addr = in6addr_loopback;
else
serv6_addr.sin6_addr = in6addr_any;
#ifdef __linux__
/* Linux, by default, allows one socket to be used by both IP stacks
* This option disables that behavior, so you must have one socket for
* each IP protocol. */
opt = 1;
if(setsockopt(sd6, IPPROTO_IPV6, IPV6_V6ONLY, &opt, sizeof(opt)) == -1) {
LogWarn("Could not set IPv6 socket option properly.\n");
goto err;
}
#endif
opt = 1;
setsockopt(sd6, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
if (bind(sd6, (struct sockaddr *) &serv6_addr, sizeof (serv6_addr)) < 0) {
LogWarn("Failed IPv6 bind: %s", strerror(errno));
goto err;
}
if (listen(sd6, TCSD_MAX_SOCKETS_QUEUED) < 0) {
LogWarn("Failed IPv6 listen: %s", strerror(errno));
goto err;
}
ssi->domain = AF_INET6;
ssi->sd = sd6;
ssi->addr_len = sizeof(serv6_addr);
return 0;
err:
if (sd6 != -1)
close(sd6);
return -1;
}
示例9: uid2grp_add_user
/**
* @brief Add a user entry to the cache
*
* @note The caller must hold uid2grp_user_lock for write.
*
* @param[in] group_data that has supplementary groups allocated
*
* @retval true on success.
* @retval false if our reach exceeds our grasp.
*/
bool uid2grp_add_user(struct group_data *gdata)
{
struct avltree_node *name_node;
struct avltree_node *id_node;
struct avltree_node *name_node2 = NULL;
struct avltree_node *id_node2 = NULL;
struct cache_info *info;
struct cache_info *tmp;
info = gsh_malloc(sizeof(struct cache_info));
if (!info) {
LogEvent(COMPONENT_IDMAPPER, "memory alloc failed");
return false;
}
info->uid = gdata->uid;
info->uname.addr = gdata->uname.addr;
info->uname.len = gdata->uname.len;
info->gdata = gdata;
/* The refcount on group_data should be 1 when we put it in
* AVL trees.
*/
uid2grp_hold_group_data(gdata);
/* We may have lost the race to insert. We remove existing
* entry and insert this new entry if so!
*/
name_node = avltree_insert(&info->uname_node, &uname_tree);
if (unlikely(name_node)) {
tmp = avltree_container_of(name_node,
struct cache_info,
uname_node);
uid2grp_remove_user(tmp);
name_node2 = avltree_insert(&info->uname_node, &uname_tree);
}
id_node = avltree_insert(&info->uid_node, &uid_tree);
if (unlikely(id_node)) {
/* We should not come here unless someone changed uid of
* a user. Remove old entry and re-insert the new
* entry.
*/
tmp = avltree_container_of(id_node,
struct cache_info,
uid_node);
uid2grp_remove_user(tmp);
id_node2 = avltree_insert(&info->uid_node, &uid_tree);
}
uid_grplist_cache[info->uid % id_cache_size] = &info->uid_node;
if (name_node && id_node)
LogWarn(COMPONENT_IDMAPPER, "shouldn't happen, internal error");
if ((name_node && name_node2) || (id_node && id_node2))
LogWarn(COMPONENT_IDMAPPER, "shouldn't happen, internal error");
return true;
}
示例10: SubscribeToIncomingCalls
IW_TELEPHONY_API ApiErrorCode
SubscribeToIncomingCalls(IN LpHandlePtr stackIncomingHandle, IN LpHandlePtr listenerHandle)
{
FUNCTRACKER;
MsgCallSubscribeReq *msg = new MsgCallSubscribeReq();
msg->listener_handle = listenerHandle;
IwMessagePtr response = NULL_MSG;
// wait for ok or nack
ApiErrorCode res = GetCurrRunningContext()->DoRequestResponseTransaction(
stackIncomingHandle,
IwMessagePtr(msg),
response,
Seconds(5),
"SubscribeToIncomingCalls TXN");
if (res == API_TIMEOUT)
{
// just to be sure that timeout-ed call
// eventually gets hanged up
LogWarn("SubscribeToIncomingCalls - Timeout.");
return API_TIMEOUT;
}
if (IW_FAILURE(res))
{
LogWarn("SubscribeToIncomingCalls - failure res:" << res);
return API_FAILURE;
}
switch (response->message_id)
{
case MSG_CALL_SUBSCRIBE_ACK:
{
res = API_SUCCESS;
break;
}
default:
{
res = API_SERVER_FAILURE;
}
}
return res;
}
示例11: LogWarn
void PyInviwo::addModulePath(const std::string& path) {
if (!Py_IsInitialized()) {
LogWarn("addModulePath(): not initialized");
return;
}
std::string pathConv = path;
replaceInString(pathConv, "\\", "/");
std::string runString = "import sys\n";
runString.append(std::string("sys.path.append('") + pathConv + std::string("')"));
int ret = PyRun_SimpleString(runString.c_str());
if (ret != 0) LogWarn("Failed to add '" + pathConv + "' to Python module search path");
}
示例12: setup_ipv4_socket
int setup_ipv4_socket(struct srv_sock_info ssi[])
{
struct sockaddr_in serv_addr;
int sd, opt;
ssi->sd = -1;
// Initialization of IPv4 socket.
sd = socket(AF_INET, SOCK_STREAM, 0);
if (sd < 0) {
LogWarn("Failed IPv4 socket: %s", strerror(errno));
goto err;
}
memset(&serv_addr, 0, sizeof (serv_addr));
serv_addr.sin_family = AF_INET;
serv_addr.sin_port = htons(tcsd_options.port);
/* If no remote_ops are defined, restrict connections to localhost
* only at the socket. */
if (tcsd_options.remote_ops[0] == 0)
serv_addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
else
serv_addr.sin_addr.s_addr = htonl(INADDR_ANY);
opt = 1;
setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt));
if (bind(sd, (struct sockaddr *) &serv_addr, sizeof (serv_addr)) < 0) {
LogWarn("Failed IPv4 bind: %s", strerror(errno));
goto err;
}
if (listen(sd, TCSD_MAX_SOCKETS_QUEUED) < 0) {
LogWarn("Failed IPv4 listen: %s", strerror(errno));
goto err;
}
ssi->domain = AF_INET;
ssi->sd = sd;
ssi->addr_len = sizeof(serv_addr);
return 0;
err:
if (sd != -1)
close(sd);
return -1;
}
示例13: admin_dbus_grace
static bool admin_dbus_grace(DBusMessageIter *args,
DBusMessage *reply)
{
#define IP_INPUT 120
char *errormsg = "Started grace period";
bool success = true;
DBusMessageIter iter;
nfs_grace_start_t gsp;
char buf[IP_INPUT];
char *input = NULL;
char *ip;
dbus_message_iter_init_append(reply, &iter);
if (args == NULL) {
errormsg = "Grace period take 1 arguments: event:IP-address.";
LogWarn(COMPONENT_DBUS, "%s", errormsg);
success = false;
goto out;
}
if (DBUS_TYPE_STRING != dbus_message_iter_get_arg_type(args)) {
errormsg = "Grace period arg 1 not a string.";
success = false;
LogWarn(COMPONENT_DBUS, "%s", errormsg);
goto out;
}
dbus_message_iter_get_basic(args, &input);
gsp.nodeid = -1;
gsp.event = EVENT_TAKE_IP;
ip = strstr(input, ":");
if (ip == NULL)
gsp.ipaddr = input; /* no event specified */
else {
gsp.ipaddr = ip+1; /* point at the ip passed the : */
strncpy(buf, input, IP_INPUT);
ip = strstr(buf, ":");
if (ip != NULL) {
*ip = 0x0; /* replace ":" with null */
gsp.event = atoi(buf);
}
if (gsp.event == EVENT_TAKE_NODEID)
gsp.nodeid = atoi(gsp.ipaddr);
}
nfs4_start_grace(&gsp);
out:
dbus_status_reply(&iter, success, errormsg);
return success;
}
示例14: defined
void Channel::HandleEventWithGuard(Timestamp receive_time) {
event_handling_ = true;
#if defined(__MACH__) || defined(__ANDROID_API__)
LogTrace("%s", REventsToString().c_str());
#else
VLOG(1) << REventsToString();
#endif
if ((revents_ & POLLHUP) && !(revents_ & POLLIN)) {
if (log_hup_) {
#if defined(__MACH__) || defined(__ANDROID_API__)
LogWarn("Channel::handle_event() POLLHUP");
#else
LOG(WARNING) << "Channel::handle_event() POLLHUP";
#endif
}
if (close_callback_) {
close_callback_();
}
}
if (revents_ & POLLNVAL) {
#if defined(__MACH__) || defined(__ANDROID_API__)
LogWarn("Channel::handle_event() POLLNVAL");
#else
LOG(WARNING) << "Channel::handle_event() POLLNVAL";
#endif
}
if (revents_ & (POLLERR | POLLNVAL)) {
if (error_callback_) error_callback_();
}
#ifndef POLLRDHUP
const int POLLRDHUP = 0;
#endif
if (revents_ & (POLLIN | POLLPRI | POLLRDHUP)) {
if (read_callback_) read_callback_(receive_time);
}
if (revents_ & POLLOUT) {
if (write_callback_) write_callback_();
}
event_handling_ = false;
}
示例15: folderCache_
CacheMonitorServer::CacheMonitorServer()
: folderCache_(Factory::GetCacheFolder()),
folderMeta_(Factory::GetMetaFolder()),
run_(true),
minFreeSize_(0), maxFreeSize_(0),
thread_(boost::thread(&CacheMonitorServer::ServerThread,this))
{
struct statfs stat;
if ( 0 != statfs(folderCache_.string().c_str(),&stat) ) {
LogWarn(folderCache_);
return;
}
off_t sizeFileSystemOnePercent =
(off_t)stat.f_bsize * stat.f_blocks / 100;
Configure * config = Factory::GetConfigure();
minFreeSize_ = config->GetValueSize(Configure::CacheFreeMinSize);
off_t sizeMinFreePercent = sizeFileSystemOnePercent
* config->GetValueSize(Configure::CacheFreeMinPercent);
minFreeSize_ = max(minFreeSize_,sizeMinFreePercent);
LogDebug(minFreeSize_);
maxFreeSize_ = config->GetValueSize(Configure::CacheFreeMaxSize);
off_t sizeMaxFreePercent = sizeFileSystemOnePercent
* config->GetValueSize(Configure::CacheFreeMaxPercent);
maxFreeSize_ = max(maxFreeSize_,sizeMaxFreePercent);
LogDebug(maxFreeSize_);
}