本文整理汇总了C++中WLOG函数的典型用法代码示例。如果您正苦于以下问题:C++ WLOG函数的具体用法?C++ WLOG怎么用?C++ WLOG使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了WLOG函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WLOG
// -----------------------------------------------------------------------------
// CActiveCaller::ConstructL
//
// -----------------------------------------------------------------------------
//
void CActiveCaller::ConstructL()
{
WLOG("CActiveCaller::ConstructL >");
User::LeaveIfError( iTimer.CreateLocal() );
CActiveScheduler::Add( this );
WLOG("CActiveCaller::ConstructL <");
}
示例2: if
TYPE& TArray2D<TYPE>::indexOf(Uint32 row, Uint32 column)
{
if(row < mRows && column < mColumns)
{
return mArray[row*mColumns + column];
}
else if(column < mColumns && mRows > 0)
{
WLOG() << "TArray2D:indexOf(" << row << "," << column
<< ") row provided exceeds maximum rows of "
<< mRows << std::endl;
return mArray[(mRows-1)*mColumns + column];
}
else if(row < mRows && mColumns > 0)
{
WLOG() << "TArray2D:indexOf(" << row << "," << column
<< ") column provided exceeds maximum columns of "
<< mColumns << std::endl;
return mArray[row*mColumns + (mColumns-1)];
}
else if(mRows > 0 && mColumns > 0)
{
WLOG() << "TArray2D:indexOf(" << row << "," << column
<< ") row and column provided exceeds maximum row of "
<< mRows << " and column of " << mColumns << std::endl;
return mArray[(mRows-1)*mColumns + (mColumns-1)];
}
else
{
ELOG() << "TArray2D:indexOf(" << row << "," << column
<< ") array is empty (no rows or columns)" << std::endl;
return mArray[0];
}
}
示例3: avgRateBytesPerSec_
Throttler::Throttler(double avgRateBytesPerSec, double peakRateBytesPerSec,
double bucketLimitBytes, int64_t throttlerLogTimeMillis)
: avgRateBytesPerSec_(avgRateBytesPerSec) {
bucketRateBytesPerSec_ = peakRateBytesPerSec;
bytesTokenBucketLimit_ =
kTimeMultiplier * kBucketMultiplier * bucketRateBytesPerSec_;
/* We keep the number of tokens generated as zero initially
* It could be argued that we keep this filled when we created the
* bucket. However the startTime is passed in this case and the hope is
* that we will have enough number of tokens by the time we send the data
*/
bytesTokenBucket_ = 0;
if (bucketLimitBytes > 0) {
bytesTokenBucketLimit_ = bucketLimitBytes;
}
if (avgRateBytesPerSec > 0) {
WLOG(INFO) << "Average rate " << avgRateBytesPerSec_ / kMbToB
<< " Mbytes/sec";
} else {
WLOG(INFO) << "No average rate specified";
}
if (bucketRateBytesPerSec_ > 0) {
WLOG(INFO) << "Peak rate " << bucketRateBytesPerSec_ / kMbToB
<< " Mbytes/sec. Bucket limit "
<< bytesTokenBucketLimit_ / kMbToB << " Mbytes.";
} else {
WLOG(INFO) << "No peak rate specified";
}
throttlerLogTimeMillis_ = throttlerLogTimeMillis;
}
示例4: controller_cb_in
static void controller_cb_in(struct loop_fd *fd, int revents) {
struct controller *controller = container_of(fd, struct controller, in);
int result;
VLOG("controller %p in %d", controller, revents);
if (revents & (POLLHUP | POLLERR)) {
ELOG("controller %p has error on stdin", controller);
controller->in.poll_flags = 0;
exit(0);
}
if (revents & (POLLIN | POLLPRI)) {
/* read from buffer */
char bytes[1024];
result = read(controller->in.fd, bytes, sizeof(bytes));
VLOG("read %d bytes from controller", result);
if (result < 0) {
WLOG("error reading controller %p %d %d", controller, result, errno);
} else {
result = controller_handle_metakey(result, bytes);
if (result > 0) {
result = buffer_output(current_buf, result, bytes);
if (result != 0) {
WLOG("buffer ran out of space! dropping chars");
}
}
}
}
}
示例5: WDT_CHECK_GT
int WdtSocket::readWithTimeout(char *buf, int nbyte, int timeoutMs,
bool tryFull) {
WDT_CHECK_GT(nbyte, 0);
if (readErrorCode_ != OK && readErrorCode_ != WDT_TIMEOUT) {
WLOG(ERROR) << "Socket read failed before, not trying to read again "
<< port_;
return -1;
}
readErrorCode_ = OK;
int numRead = 0;
readEncryptionSettingsOnce(timeoutMs);
if (supportUnencryptedPeer_ && readErrorCode_ == UNEXPECTED_CMD_ERROR) {
WLOG(WARNING)
<< "Turning off encryption since the other side does not support "
"encryption "
<< port_;
readErrorCode_ = OK;
buf[0] = buf_[0];
numRead = 1;
// also turn off encryption
encryptionParams_.erase();
} else if (readErrorCode_ != OK) {
return -1;
}
if (nbyte == numRead) {
return nbyte;
}
bool encrypt = encryptionParams_.isSet();
int ret = readInternal(buf + numRead, nbyte - numRead, timeoutMs, tryFull);
if (ret >= 0) {
numRead += ret;
} else {
return (numRead > 0 ? numRead : -1);
}
if (!encrypt) {
return numRead;
}
int numDecrypted = 0;
if (ctxSaveOffset_ >= 0) {
if (ctxSaveOffset_ <= numRead) {
if (!decryptor_.decrypt(buf, ctxSaveOffset_, buf)) {
readErrorCode_ = ENCRYPTION_ERROR;
return -1;
}
decryptor_.saveContext();
numDecrypted = ctxSaveOffset_;
ctxSaveOffset_ = CTX_SAVED;
} else {
ctxSaveOffset_ -= numRead;
}
}
// have to decrypt data
if (!decryptor_.decrypt((buf + numDecrypted), (numRead - numDecrypted),
(buf + numDecrypted))) {
readErrorCode_ = ENCRYPTION_ERROR;
return -1;
}
return numRead;
}
示例6: wxString
void UserSettings::FromXml(TiXmlElement* xml) {
for (TiXmlElement* element = xml->FirstChildElement(); element; element = element->NextSiblingElement()) {
wxString elementName = wxString(element->Value(), wxConvUTF8);
if (elementName != _T("Setting")) {
WLOG(wxString::Format(_T("UserSettings::FromXml: Unknown element: %s"), elementName));
continue;
}
const char* cSettingName = element->Attribute("name");
if (!cSettingName) {
WLOG(_T("UserSettings::FromXml: setting doesn't have a name"));
continue;
}
const char* cSettingValue = element->GetText();
wxString n = wxString(cSettingName, wxConvUTF8);
wxString v;
if (!cSettingValue) {
v = wxEmptyString;
} else {
v = wxString(cSettingValue, wxConvUTF8);
}
v.Trim(true).Trim(false);
if (n == _T("IconSize")) AssignSettingValue(IconSize, v);
if (n == _T("Locale")) Locale = v;
if (n == _T("PortableAppsPath")) PortableAppsPath = v;
if (n == _T("DocumentsPath")) DocumentsPath = v;
if (n == _T("MusicPath")) MusicPath = v;
if (n == _T("PicturesPath")) PicturesPath = v;
if (n == _T("VideosPath")) VideosPath = v;
if (n == _T("Skin")) Skin = v;
if (n == _T("Rotated")) Rotated = ParseBoolean(v);
if (n == _T("NextUpdateCheckTime")) {
const wxChar* c = NextUpdateCheckTime.ParseFormat(v, ISO_DATE_FORMAT);
if (!c) NextUpdateCheckTime = wxDateTime::Now();
}
if (n == _T("AlwaysOnTop")) AlwaysOnTop = ParseBoolean(v);
if (n == _T("AutoHideApplication")) AutoHideApplication = ParseBoolean(v);
if (n == _T("UniqueApplicationInstance")) UniqueApplicationInstance = ParseBoolean(v);
if (n == _T("ShowDeleteIconMessage")) ShowDeleteIconMessage = ParseBoolean(v);
if (n == _T("ShowEjectDriveMessage")) ShowEjectDriveMessage = ParseBoolean(v);
if (n == _T("RunMultiLaunchOnStartUp")) RunMultiLaunchOnStartUp = ParseBoolean(v);
if (n == _T("HotKeyControl")) HotKeyControl = ParseBoolean(v);
if (n == _T("HotKeyAlt")) HotKeyAlt = ParseBoolean(v);
if (n == _T("HotKeyShift")) HotKeyShift = ParseBoolean(v);
if (n == _T("HotKeyKey")) AssignSettingValue(HotKeyKey, v);
if (n == _T("CloseAppsOnEject")) CloseAppsOnEject = ParseBoolean(v);
if (n == _T("MinimizeOnClose")) MinimizeOnClose = ParseBoolean(v);
if (n == _T("ShowMinimizeMessage")) ShowMinimizeMessage = ParseBoolean(v);
}
}
示例7: WDT_CHECK
void WdtBase::configureThrottler() {
WDT_CHECK(!throttler_);
WVLOG(1) << "Configuring throttler options";
throttler_ = Throttler::makeThrottler(options_);
if (throttler_) {
WLOG(INFO) << "Enabling throttling " << *throttler_;
} else {
WLOG(INFO) << "Throttling not enabled";
}
}
示例8: mosq_setup
bool mosq_setup(struct _squash *st)
{
mosquitto_lib_init();
DLOG("mosquitto -> (re)connecting\n");
st->mosq = mosquitto_new(NULL, true, st);
mosquitto_log_callback_set(st->mosq, mosq_logger);
mosquitto_message_callback_set(st->mosq, st->msg_handler);
int rc = mosquitto_connect(st->mosq, st->mq_host, 1883, 60);
if (MOSQ_ERR_SUCCESS != rc) {
WLOG("Failed to connect: %s\n", strerror(errno));
rc = -1;
goto unwind;
}
int mosq_fd = mosquitto_socket(st->mosq);
if (evutil_make_socket_nonblocking(mosq_fd)) {
WLOG("Failed to make non-blocking: fd = %d, possibly ok\n", mosq_fd);
}
st->mosq_readidle = event_new(st->base, mosq_fd, EV_READ|EV_PERSIST, mosq_ev_io, st);
if (st->mosq_readidle == NULL) {
WLOG("Failed to create mosquitto read/idle watcher\n");
rc = -1;
goto unwind_readidle;
}
st->mosq_write = event_new(st->base, mosq_fd, EV_WRITE, mosq_ev_io, st);
if (st->mosq_write == NULL) {
WLOG("Failed to create mosquitto write watcher\n");
rc = -1;
goto unwind_write;
}
if (mosquitto_want_write(st->mosq)) {
event_add(st->mosq_write, NULL);
}
struct timeval mosq_idle_loop_time = { 0, 100 * 1000 };
if (event_add(st->mosq_readidle, &mosq_idle_loop_time) < 0) {
WLOG("Failed to activate mosquitto watcher\n");
rc = -1;
goto unwind_write;
}
goto out;
unwind_write:
event_free(st->mosq_write);
unwind_readidle:
event_free(st->mosq_readidle);
unwind:
mosquitto_destroy(st->mosq);
mosquitto_lib_cleanup();
out:
return rc == 0;
}
示例9: WDT_CHECK
int64_t WdtSocket::ioWithAbortCheck(F readOrWrite, T tbuf, int64_t numBytes,
int timeoutMs, bool tryFull) {
WDT_CHECK(threadCtx_.getAbortChecker() != nullptr)
<< "abort checker can not be null";
bool checkAbort = (threadCtx_.getOptions().abort_check_interval_millis > 0);
auto startTime = Clock::now();
int64_t doneBytes = 0;
int retries = 0;
while (doneBytes < numBytes) {
const int64_t ret =
readOrWrite(fd_, tbuf + doneBytes, numBytes - doneBytes);
if (ret < 0) {
// error
if (errno != EINTR && errno != EAGAIN) {
PLOG(ERROR) << "non-retryable error encountered during socket io "
<< fd_ << " " << doneBytes << " " << retries;
return (doneBytes > 0 ? doneBytes : ret);
}
} else if (ret == 0) {
// eof
WVLOG(1) << "EOF received during socket io. fd : " << fd_
<< ", finished bytes : " << doneBytes
<< ", retries : " << retries;
return doneBytes;
} else {
// success
doneBytes += ret;
if (!tryFull) {
// do not have to read/write entire data
return doneBytes;
}
}
if (checkAbort && threadCtx_.getAbortChecker()->shouldAbort()) {
WLOG(ERROR) << "transfer aborted during socket io " << fd_ << " "
<< doneBytes << " " << retries;
return (doneBytes > 0 ? doneBytes : -1);
}
if (timeoutMs > 0) {
int duration = durationMillis(Clock::now() - startTime);
if (duration >= timeoutMs) {
WLOG(INFO) << "socket io timed out after " << duration
<< " ms, retries " << retries << " fd " << fd_
<< " doneBytes " << doneBytes;
return (doneBytes > 0 ? doneBytes : -1);
}
}
retries++;
}
WVLOG_IF(1, retries > 1) << "socket io for " << doneBytes << " bytes took "
<< retries << " retries";
return doneBytes;
}
示例10: get_usb_mass_storage_status
static int get_usb_mass_storage_status(libusb_device_handle *handle, uint8_t endpoint, uint32_t *tag)
{
unsigned char csw[13];
memset(csw, 0, sizeof(csw));
int transferred;
int ret;
int try = 0;
do {
ret = libusb_bulk_transfer(handle, endpoint, (unsigned char *)&csw, sizeof(csw),
&transferred, SG_TIMEOUT_MSEC);
if (ret == LIBUSB_ERROR_PIPE) {
libusb_clear_halt(handle, endpoint);
}
try++;
} while ((ret == LIBUSB_ERROR_PIPE) && (try < 3));
if (ret != LIBUSB_SUCCESS) {
WLOG("%s: receiving failed: %d\n", __func__, ret);
return -1;
}
if (transferred != sizeof(csw)) {
WLOG("%s: received unexpected amount: %d\n", __func__, transferred);
return -1;
}
uint32_t rsig = read_uint32(csw, 0);
uint32_t rtag = read_uint32(csw, 4);
/* uint32_t residue = read_uint32(csw, 8); */
#define USB_CSW_SIGNATURE 0x53425355 // 'U' 'S' 'B' 'S' (reversed)
if (rsig != USB_CSW_SIGNATURE) {
WLOG("status signature was invalid: %#x\n", rsig);
return -1;
}
*tag = rtag;
uint8_t rstatus = csw[12];
return rstatus;
}
static int dump_CDB_command(uint8_t *cdb, uint8_t cdb_len) {
char dbugblah[100];
char *dbugp = dbugblah;
dbugp += sprintf(dbugp, "Sending CDB [");
for (uint8_t i = 0; i < cdb_len; i++) {
dbugp += sprintf(dbugp, " %#02x", (unsigned int) cdb[i]);
}
sprintf(dbugp, "]\n");
DLOG(dbugblah);
return 0;
}
示例11: guard
void ScreenManager::processFinishDialog() {
if (dialogFinished_) {
std::lock_guard<std::mutex> guard(inputLock_);
// Another dialog may have been pushed before the render, so search for it.
Screen *caller = 0;
for (size_t i = 0; i < stack_.size(); ++i) {
if (stack_[i].screen != dialogFinished_) {
continue;
}
stack_.erase(stack_.begin() + i);
// The previous screen was the caller (not necessarily the topmost.)
if (i > 0) {
caller = stack_[i - 1].screen;
}
}
if (!caller) {
ELOG("ERROR: no top screen when finishing dialog");
} else if (caller != topScreen()) {
// The caller may get confused if we call dialogFinished() now.
WLOG("Skipping non-top dialog when finishing dialog.");
} else {
caller->dialogFinished(dialogFinished_, dialogResult_);
}
delete dialogFinished_;
dialogFinished_ = 0;
}
}
示例12: unregister_gl_resource_holder
void unregister_gl_resource_holder(GfxResourceHolder *holder) {
if (holders) {
holders->remove(holder);
} else {
WLOG("GL resource holder not initialized or already shutdown, cannot unregister resource");
}
}
示例13: register_gl_resource_holder
void register_gl_resource_holder(GfxResourceHolder *holder) {
if (holders) {
holders->push_back(holder);
} else {
WLOG("GL resource holder not initialized, cannot register resource");
}
}
示例14: getFileInfo
bool getFileInfo(const char *path, FileInfo *fileInfo)
{
// TODO: Expand relative paths?
fileInfo->fullName = path;
#ifdef _WIN32
fileInfo->size = 0;
WIN32_FILE_ATTRIBUTE_DATA attrs;
if (GetFileAttributesExA(path, GetFileExInfoStandard, &attrs)) {
fileInfo->size = (uint64_t)attrs.nFileSizeLow | ((uint64_t)attrs.nFileSizeHigh << 32);
}
fileInfo->isDirectory = (attrs.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0;
fileInfo->isWritable = (attrs.dwFileAttributes & FILE_ATTRIBUTE_READONLY) == 0;
#else
struct stat64 file_info;
std::string copy(path);
stripTailDirSlashes(copy);
int result = stat64(copy.c_str(), &file_info);
if (result < 0) {
WLOG("IsDirectory: stat failed on %s", path);
return false;
}
fileInfo->isDirectory = S_ISDIR(file_info.st_mode);
fileInfo->isWritable = false;
fileInfo->size = file_info.st_size;
// HACK: approximation
if (file_info.st_mode & 0200)
fileInfo->isWritable = true;
#endif
return true;
}
示例15: WLOG
/**
* drop the table based on the provided table name,
* this operator will delete the table in the catalog as well as the table file
*on the disk or hdfs
*
* @param table_name
* @return
*/
RetCode DropTableExec::DropTable(const string& table_name) {
RetCode ret = rSuccess;
Catalog* local_catalog = Environment::getInstance()->getCatalog();
if ("" == table_name) {
ret = rNULLDropTableName;
WLOG(ret, "the name of the table to be dropped is NULL");
return ret;
}
// start to drop table
// you need to delete the file first, and then drop the informantion in the
// catalog
ret = DeleteTableFiles(table_name);
if (rSuccess != ret) {
ELOG(ret, "failed to delete the files when dropping table" + table_name);
return ret;
} else {
ret = DropTableFromCatalog(table_name);
if (ret != rSuccess) {
ELOG(ret,
"failed to drop the table from the catalog, while its files have "
"been deleted, when dropping table" +
table_name);
return ret;
}
}
}