Пример #1
0
void logShadowValidationError(proxy_t& proxy,
                              const ShadowValidationData& valData) {
  VLOG_EVERY_N(1,100)
      << "Mismatch between shadow and normal reply" << std::endl
      << "Key:" << valData.fullKey << std::endl
      << "Expected Result:"
      << mc_res_to_string(valData.normalResult) << std::endl
      << "Shadow Result:"
      << mc_res_to_string(valData.shadowResult) << std::endl;
}
Пример #2
0
LocalAdjListGraph::LocalAdjListGraph(std::unordered_set<Edge, Edge_hasher>& edges) : adjs() {
  // assume that the vertex ids are not compressed

  DVLOG(5) << "local construction: ";
  for (auto e : edges) {
    DVLOG(5) << "  " << e;
    VLOG_EVERY_N(4, 100000) << "edges: " << google::COUNTER;
    auto& val = adjs[e.src];
    val.push_back(e.dst);
  }
}
Пример #3
0
INITIALIZE_EASYLOGGINGPP

int main(int argc, char** argv) {
    START_EASYLOGGINGPP(argc, argv);
    el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
    el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);

    // You can uncomment following lines to take advantage of hierarchical logging
    // el::Loggers::addFlag(el::LoggingFlag::HierarchicalLogging);
    // el::Loggers::setLoggingLevel(el::Level::Global);

    LOG(INFO);
    LOG(DEBUG);
    LOG(WARNING);
    LOG(ERROR);
    LOG(TRACE);
    VLOG(1);
    LOG(FATAL);

    DLOG(INFO);
    DLOG(DEBUG);
    DLOG(WARNING);
    DLOG(ERROR);
    DLOG(TRACE);
    DVLOG(1);
    DLOG(FATAL);

    LOG(INFO) << "Turning off colored output";
    el::Loggers::removeFlag(el::LoggingFlag::ColoredTerminalOutput);
    
    LOG_IF(true, INFO);
    LOG_IF(true, DEBUG);
    LOG_IF(true, WARNING);
    LOG_IF(true, ERROR);
    LOG_IF(true, TRACE);
    VLOG_IF(true, 1);
    LOG_IF(true, FATAL);

    LOG_EVERY_N(1, INFO);
    LOG_EVERY_N(1, DEBUG);
    LOG_EVERY_N(1, WARNING);
    LOG_EVERY_N(1, ERROR);
    LOG_EVERY_N(1, TRACE);
    VLOG_EVERY_N(1, 1);
    LOG_EVERY_N(1, FATAL);

    CHECK(1 == 1);
    CCHECK(1 == 1, "default");
    return 0;
}
Пример #4
0
_INITIALIZE_EASYLOGGINGPP

int main(int argc, char** argv) {
  _START_EASYLOGGINGPP(argc, argv);
  LOG(INFO) << "This is demo for verbose logs";
  VLOG(1) << "This will be printed when program is started using argument --v=1";
  VLOG(2) << "This will be printed when program is started using argument --v=2";
  VLOG(1) << "This will be printed when program is started using argument --v=1";
  VLOG_IF(true, 1) << "Always verbose for level 1";

  VLOG_EVERY_N(1, 3) << "Verbose every N";

  VLOG(4) << "Command line arguments provided " << *el::Helpers::commandLineArgs();
  return 0;
}
Пример #5
0
void *write(void* thrId){
  char* threadId = (char*)thrId;
  // Following line will be logged with every thread
  LOG(INFO) << "This standard log is written by [Thread #" << threadId << "]";
  // Following line will be logged with every thread only when --v=2 argument 
  // is provided, i.e, ./bin/multithread_test.cpp.bin --v=2
  VLOG(2) << "This is verbose level 2 logging from [Thread #" << threadId << "]";

  // Following line will be logged only once from second running thread (which every runs second into 
  // this line because of interval 2)
  LOG_EVERY_N(2, WARNING) << "This will be logged only once from thread who every reaches this line first. Currently running from [Thread #" << threadId << "]";

  for (int i = 1; i <= 10; ++i) {
     VLOG_IF(true, 2) << "Verbose condition [Thread #" << threadId << "]";
     VLOG_EVERY_N(2, 3) << "Verbose level 3 log every 4th time. This is at " << i << " from [Thread #" << threadId << "]";
  }

  // Following line will be logged once with every thread because of interval 1 
  LOG_EVERY_N(1, INFO) << "This interval log will be logged with every thread, this one is from [Thread #" << threadId << "]";

  LOG_IF(strcmp(threadId, "2") == 0, INFO) << "This log is only for thread 2 and is ran by [Thread #" << threadId << "]";
  
  // Register 5 vague loggers
  for (int i = 1; i <= 5; ++i) {
     std::stringstream ss;
     ss << "logger" << i;
     el::Logger* logger = el::Loggers::getLogger(ss.str());
     LOG(INFO) << "Registered logger [" << *logger << "] [Thread #" << threadId << "]";
     CLOG(INFO, "default", "network") << "Triggering network log from default and network";
  }
  CLOG(INFO, "logger1") << "Logging using new logger [Thread #" << threadId << "]";
  CLOG(INFO, "no-logger") << "THIS SHOULD SAY LOGGER NOT REGISTERED YET [Thread #" << threadId << "]"; // << -- NOTE THIS!
  CLOG(INFO, "default", "network") << "Triggering network log from default and network";

  el::Logger* logger = el::Loggers::getLogger("default");
  logger->info("Info log from [Thread #%v]", threadId);

  // Check for log counters positions
  for (int i = 1; i <= 50; ++i) {
     LOG_EVERY_N(2, INFO) << "Counter pos: " << ELPP_COUNTER_POS << " [Thread #" << threadId << "]";
  }
  LOG_EVERY_N(2, INFO) << "Counter pos: " << ELPP_COUNTER_POS << " [Thread #" << threadId << "]";
  return NULL;
}
Пример #6
0
_INITIALIZE_EASYLOGGINGPP

int main(int argc, char** argv) {
    _START_EASYLOGGINGPP(argc, argv);
    el::Helpers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
    
    LOG(INFO);
    LOG(DEBUG);
    LOG(WARNING);
    LOG(ERROR);
    LOG(TRACE);
    VLOG(1);
    LOG(FATAL);

    DLOG(INFO);
    DLOG(DEBUG);
    DLOG(WARNING);
    DLOG(ERROR);
    DLOG(TRACE);
    DVLOG(1);
    DLOG(FATAL);

    LOG_IF(true, INFO);
    LOG_IF(true, DEBUG);
    LOG_IF(true, WARNING);
    LOG_IF(true, ERROR);
    LOG_IF(true, TRACE);
    VLOG_IF(true, 1);
    LOG_IF(true, FATAL);

    LOG_EVERY_N(1, INFO);
    LOG_EVERY_N(1, DEBUG);
    LOG_EVERY_N(1, WARNING);
    LOG_EVERY_N(1, ERROR);
    LOG_EVERY_N(1, TRACE);
    VLOG_EVERY_N(1, 1);
    LOG_EVERY_N(1, FATAL);

    CHECK(1 == 1);
    CCHECK(1 == 1, "default");
    return 0;
}
shared_ptr<TTransport> TSaslServerTransport::Factory::getTransport(
    shared_ptr<TTransport> trans) {
  lock_guard<mutex> l(transportMap_mutex_);
  // Thrift servers use both an input and an output transport to communicate with
  // clients. In principal, these can be different, but for SASL clients we require them
  // to be the same so that the authentication state is identical for communication in
  // both directions. In order to do this, we cache the transport that we return in a map
  // keyed by the transport argument to this method. Then if there are two successive
  // calls to getTransport() with the same transport, we are sure to return the same
  // wrapped transport both times.
  //
  // However, the cache map would retain references to all the transports it ever
  // created. Instead, we remove an entry in the map after it has been found for the first
  // time, that is, after the second call to getTransport() with the same argument. That
  // matches the calling pattern in TThreadedServer and TThreadPoolServer, which both call
  // getTransport() twice in succession when a connection is established, and then never
  // again. This is obviously brittle (what if for some reason getTransport() is called a
  // third time?) but for our usage of Thrift it's a tolerable band-aid.
  //
  // An alternative approach is to use the 'custom deleter' feature of shared_ptr to
  // ensure that when ret_transport is eventually deleted, its corresponding map entry is
  // removed. That is likely to be error prone given the locking involved; for now we go
  // with the simple solution.
  map<shared_ptr<TTransport>, shared_ptr<TBufferedTransport> >::iterator trans_map =
      transportMap_.find(trans);
  VLOG_EVERY_N(2, 100) << "getTransport(): transportMap_ size is: "
                       << transportMap_.size();
  shared_ptr<TBufferedTransport> ret_transport;
  if (trans_map == transportMap_.end()) {
    shared_ptr<TTransport> wrapped(new TSaslServerTransport(serverDefinitionMap_, trans));
    ret_transport.reset(new TBufferedTransport(wrapped));
    ret_transport.get()->open();
    transportMap_[trans] = ret_transport;
  } else {
    ret_transport = trans_map->second;
    transportMap_.erase(trans_map);
  }
  return ret_transport;
}