当前位置: 首页>>代码示例>>C++>>正文


C++ LOG_F函数代码示例

本文整理汇总了C++中LOG_F函数的典型用法代码示例。如果您正苦于以下问题:C++ LOG_F函数的具体用法?C++ LOG_F怎么用?C++ LOG_F使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了LOG_F函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: test6

	void test6()
	{
		log4cxx::PropertyConfigurator::configure("log4cxx.properties");
		log4cxx::LoggerPtr loggerA(log4cxx::Logger::getLogger("aaa"));  
		log4cxx::LoggerPtr loggerB(log4cxx::Logger::getLogger("bbb")); 
		LOG_F("\n");
		LOG4CXX_INFO(loggerA, "this is log4cxx test"); 
		LOG4CXX_INFO(loggerB, "this is log4cxx test"); 


		log4cxx::LoggerPtr logger0(log4cxx::Logger::getLogger("logger0")); 
		LOG4CXX_DEBUG(logger0, "hello");
		LOG4CXX_TRACE(logger0, "hello");
		LOG4CXX_INFO(logger0, "hello");
		LOG4CXX_WARN(logger0, "hello");
		LOG4CXX_ERROR(logger0, "hello");
		LOG4CXX_FATAL(logger0, "hello");

// 		std::set<int> cList;
// 		LOG4CXX_INFO(logger0, cList);

		//log4j.logger.logger0 = INFO, ap0  

// 		INFO 23:02:03 -- hello
// 		WARN 23:02:04 -- hello
// 		ERROR 23:02:04 -- hello
// 		FATAL 23:02:04 -- hello

		LOG_F("\n");
	}
开发者ID:QC-git,项目名称:MyLab,代码行数:30,代码来源:test1_util.cpp

示例2: test_SIGSEGV_0

void test_SIGSEGV_0()
{
	LOG_F(INFO, "Intentionally writing to nullptr:");
	int* ptr = nullptr;
	*ptr = 42;
	LOG_F(FATAL, "We shouldn't get here");
}
开发者ID:zjf984078330,项目名称:loguru,代码行数:7,代码来源:loguru_test.cpp

示例3: test_thread_names

void test_thread_names()
{
	LOG_SCOPE_FUNCTION(INFO);

	{
		char thread_name[17];
		loguru::get_thread_name(thread_name, sizeof(thread_name), false);
		LOG_F(INFO, "Hello from main thread ('%s')", thread_name);
	}

	auto a = std::thread([](){
		char thread_name[17];
		loguru::get_thread_name(thread_name, sizeof(thread_name), false);
		LOG_F(INFO, "Hello from nameless thread ('%s')", thread_name);
	});

	auto b = std::thread([](){
		loguru::set_thread_name("renderer");
		char thread_name[17];
		loguru::get_thread_name(thread_name, sizeof(thread_name), false);
		LOG_F(INFO, "Hello from render thread ('%s')", thread_name);
	});

	auto c = std::thread([](){
		loguru::set_thread_name("abcdefghijklmnopqrstuvwxyz");
		char thread_name[17];
		loguru::get_thread_name(thread_name, sizeof(thread_name), false);
		LOG_F(INFO, "Hello from thread with a very long name ('%s')", thread_name);
	});

	a.join();
	b.join();
	c.join();
}
开发者ID:WS-Libraries,项目名称:loguru,代码行数:34,代码来源:loguru_test.cpp

示例4: main

int main(int argc, char **argv)
{
    honggfuzz_t hfuzz;
    if (cmdlineParse(argc, argv, &hfuzz) == false) {
        LOG_F("Parsing of the cmd-line arguments failed");
    }

    if (!files_init(&hfuzz)) {
        LOG_F("Couldn't load input files");
        exit(EXIT_FAILURE);
    }

    if (hfuzz.dictionaryFile && (files_parseDictionary(&hfuzz) == false)) {
        LOG_F("Couldn't parse dictionary file ('%s')", hfuzz.dictionaryFile);
    }

    if (hfuzz.blacklistFile && (files_parseBlacklist(&hfuzz) == false)) {
        LOG_F("Couldn't parse stackhash blacklist file ('%s')", hfuzz.blacklistFile);
    }

    /*
     * So far so good
     */
    fuzz_main(&hfuzz);

    abort();                    /* NOTREACHED */
    return EXIT_SUCCESS;
}
开发者ID:QardenEden,项目名称:honggfuzz,代码行数:28,代码来源:honggfuzz.c

示例5: throw_on_fatal

void throw_on_fatal()
{
	loguru::set_fatal_handler([](const loguru::Message& message){
		LOG_F(INFO, "Throwing exception...");
		throw std::runtime_error(std::string(message.prefix) + message.message);
	});
	{
		LOG_SCOPE_F(INFO, "CHECK_F throw + catch");
		try {
			CHECK_F(false, "some CHECK_F message");
		} catch (std::runtime_error& e) {
			LOG_F(INFO, "CHECK_F threw this: '%s'", e.what());
		}
	}
#if LOGURU_WITH_STREAMS
	{
		LOG_SCOPE_F(INFO, "CHECK_S throw + catch");
		try {
			CHECK_S(false) << "Some CHECK_S message";
		} catch (std::runtime_error& e) {
			LOG_F(INFO, "CHECK_S threw this: '%s'", e.what());
		}
	}
	LOG_F(INFO, "Trying an uncaught exception:");
	CHECK_S(false);
#else
	CHECK_F(false);
#endif // LOGURU_WITH_STREAMS
}
开发者ID:WS-Libraries,项目名称:loguru,代码行数:29,代码来源:loguru_test.cpp

示例6: files_parseBlacklist

bool files_parseBlacklist(honggfuzz_t * hfuzz)
{
    FILE *fBl = fopen(hfuzz->blacklistFile, "rb");
    if (fBl == NULL) {
        PLOG_W("Couldn't open '%s' - R/O mode", hfuzz->blacklistFile);
        return false;
    }
    defer {
        fclose(fBl);
    };

    char *lineptr = NULL;
    /* lineptr can be NULL, but it's fine for free() */
    defer {
        free(lineptr);
    };
    size_t n = 0;
    for (;;) {
        if (getline(&lineptr, &n, fBl) == -1) {
            break;
        }

        if ((hfuzz->blacklist =
             util_Realloc(hfuzz->blacklist,
                          (hfuzz->blacklistCnt + 1) * sizeof(hfuzz->blacklist[0]))) == NULL) {
            PLOG_W("realloc failed (sz=%zu)",
                   (hfuzz->blacklistCnt + 1) * sizeof(hfuzz->blacklist[0]));
            return false;
        }

        hfuzz->blacklist[hfuzz->blacklistCnt] = strtoull(lineptr, 0, 16);
        LOG_D("Blacklist: loaded %'" PRIu64 "'", hfuzz->blacklist[hfuzz->blacklistCnt]);

        // Verify entries are sorted so we can use interpolation search
        if (hfuzz->blacklistCnt > 1) {
            if (hfuzz->blacklist[hfuzz->blacklistCnt - 1] > hfuzz->blacklist[hfuzz->blacklistCnt]) {
                LOG_F
                    ("Blacklist file not sorted. Use 'tools/createStackBlacklist.sh' to sort records");
                return false;
            }
        }
        hfuzz->blacklistCnt += 1;
    }

    if (hfuzz->blacklistCnt > 0) {
        LOG_I("Loaded %zu stack hash(es) from the blacklist file", hfuzz->blacklistCnt);
    } else {
        LOG_F("Empty stack hashes blacklist file '%s'", hfuzz->blacklistFile);
    }
    return true;
}
开发者ID:dyjakan,项目名称:honggfuzz,代码行数:51,代码来源:files.c

示例7: main_test

int main_test(int argc, char* argv[])
{
	loguru::init(argc, argv);
	LOG_SCOPE_FUNCTION(INFO);
	LOG_F(INFO, "Doing some stuff...");
	for (int i=0; i<2; ++i) {
		LOG_SCOPE_F(1, "Iteration %d", i);
		auto result = some_expensive_operation();
		LOG_IF_F(WARNING, result == BAD, "Bad result");
	}
	LOG_F(INFO, "Time to go!");

	return 0;
}
开发者ID:zjf984078330,项目名称:loguru,代码行数:14,代码来源:loguru_test.cpp

示例8: load_shader

unsigned load_shader(GLenum type, const char* source, const char* debug_name)
{
	CHECK_FOR_GL_ERROR;

	unsigned id = glCreateShader(type);

	const char* code = source;
	glShaderSource(id, 1, &code, nullptr);
	glCompileShader(id);

	CHECK_FOR_GL_ERROR;

	GLint status = 0;
	glGetShaderiv(id, GL_COMPILE_STATUS, &status);

	CHECK_FOR_GL_ERROR;

	//std::string log = Trim( GetShaderLog(id) );

	if (status == 0) {
		CHECK_FOR_GL_ERROR;

		LOG_F(INFO, "-------------------------------------");
		LOG_F(INFO, "%s", source);
		LOG_F(INFO, "-------------------------------------");

		LOG_F(ERROR, "Failed to compile %s shader for program \"%s\".",
					(type==GL_VERTEX_SHADER ? "vertex" : "fragment"), debug_name);

		GLint log_length = -1;
		glGetShaderiv(id, GL_INFO_LOG_LENGTH, &log_length);

		CHECK_FOR_GL_ERROR;

		if (log_length > 0)
		{
			std::vector<GLchar> log((unsigned)log_length);
			glGetShaderInfoLog(id, log_length, &log_length, log.data());
			LOG_F(ERROR, "Shader log:\n%s", log.data());
		}

		CHECK_FOR_GL_ERROR;

		glDeleteShader(id);

		throw std::runtime_error("Shader compilation error");
	}

	return id;
}
开发者ID:csulmone,项目名称:emilib,代码行数:50,代码来源:gl_lib.cpp

示例9: test_hang_0

void test_hang_0()
{
	LOG_F(INFO, "Press ctrl-C to kill.");
	for(;;) {
		// LOG_F(INFO, "Press ctrl-C to break out of this infinite loop.");
	}
}
开发者ID:zjf984078330,项目名称:loguru,代码行数:7,代码来源:loguru_test.cpp

示例10: read_binary_file

std::vector<uint8_t> read_binary_file(const std::string& path)
{
	FILEWrapper fp(path, "rb");

	size_t size = file_size(path);
	if (size <= 0) {
		// Fail?
		size_t chunk_size = 1024*128; // Size of first chunk
		size_t nRead = 0;

		std::vector<uint8_t> bytes;

		while (!fp.end_of_file()) {
			bytes.resize(nRead + chunk_size);
			size_t n = fp.try_read(&bytes[nRead], chunk_size);
			nRead += n;
			bytes.resize(nRead);
			chunk_size *= 2; // Read progressively larger chunks
		}

		bytes.shrink_to_fit();

		return bytes;
	} else {
		std::vector<uint8_t> bytes(size);
		size_t n = fp.try_read(bytes.data(), size);
		if (n != size) {
			LOG_F(ERROR, "read_binary_file failed");
		}

		return bytes;
	}
}
开发者ID:emilk,项目名称:emilib,代码行数:33,代码来源:file_system.cpp

示例11: LOG_F

void SiteTask::GotResponse(int status_code, const char * buf, int len) {
    LOG_F(LS_VERBOSE) << "state:" << GetStateName(GetState())
        << " status:" << status_code << " len:" << len
        << " current: " << curact_;

    SignalActionResponse(site_.actions()[curact_], HttpResponse(status_code, buf, len));
}
开发者ID:3rdexp,项目名称:jezzitest,代码行数:7,代码来源:infoengine.cpp

示例12: perf_ptAnalyzePkt

inline static void perf_ptAnalyzePkt(honggfuzz_t * hfuzz, fuzzer_t * fuzzer,
                                     struct pt_packet *packet, struct pt_config *ptc,
                                     struct pt_last_ip *last_ip)
{
    switch (packet->type) {
    case ppt_tip:
    case ppt_fup:
    case ppt_tip_pge:
    case ppt_tip_pgd:
        break;
    default:
        return;
    }

    int errcode = pt_last_ip_update_ip(last_ip, &(packet->payload.ip), ptc);
    if (errcode < 0) {
        LOG_F("pt_last_ip_update_ip() failed: %s", pt_errstr(errcode));
    }

    /* Update only on TIP, other packets don't indicate a branch */
    if (packet->type == ppt_tip) {
        uint64_t ip;
        errcode = pt_last_ip_query(&ip, last_ip);
        if (errcode == 0) {
            ip &= _HF_PERF_BITMAP_BITSZ_MASK;
            register uint8_t prev = ATOMIC_BTS(hfuzz->feedback->bbMapPc, ip);
            if (!prev) {
                fuzzer->linux.hwCnts.newBBCnt++;
            }
        }
    }
    return;
}
开发者ID:anestisb,项目名称:honggfuzz,代码行数:33,代码来源:pt.c

示例13: LOG_F

void FILEWrapper::flush()
{
	if (fflush(_fp) != 0) {
		const auto errno_text = loguru::errno_as_text();
		LOG_F(WARNING, "fflush failed: %s", errno_text.c_str());
	}
}
开发者ID:emilk,项目名称:emilib,代码行数:7,代码来源:file_system.cpp

示例14: ASSERT

//////////////////////////////////////////////////////////////////////////
//Implement Proxy p2p session
bool P2PProxySession::RegisterP2PProxySocket(
  P2PProxySocket *p2p_proxy_socket, bool is_server)
{
  ASSERT(signal_thread_->IsCurrent());
  if(state_ == P2P_CLOSING)
    state_ = P2P_CONNECTED;
  if(state_ == P2P_CLOSE)
    return false;
  P2PProxySockets::iterator iter = p2p_proxy_sockets_.find(
    p2p_proxy_socket->GetSocketNumber());

  if(iter != p2p_proxy_sockets_.end()){
    LOG_F(LS_ERROR) << "\t the proxy socket begin is existed" 
      << std::endl;
    return false;
  }
  p2p_proxy_sockets_.insert(P2PProxySockets::value_type(
    p2p_proxy_socket->GetSocketNumber(),p2p_proxy_socket));
  
    std::cout << "\n********* \n"
    << "Current p2p socket size is "
    << p2p_proxy_sockets_.size()
    << "\n*********" << std::endl;

  SignalPeerConnectSucceed.connect(p2p_proxy_socket,
    &P2PProxySocket::OnP2PConnectSucceed);
  SignalPeerConnectFailure.connect(p2p_proxy_socket,
    &P2PProxySocket::OnP2PClose);
  if(is_server && state_ == P2P_CONNECTED)
    p2p_proxy_socket->OnP2PConnectSucceed(this);
  return true;
}
开发者ID:coderlirui,项目名称:LibIceSolution,代码行数:34,代码来源:p2pproxysession.cpp

示例15: util_rndGet

uint64_t util_rndGet(uint64_t min, uint64_t max)
{
    if (min > max) {
        LOG_F("min:%" PRIu64 " > max:%" PRIu64, min, max);
    }

    if (util_urandomFd == -1) {
        if ((util_urandomFd = open("/dev/urandom", O_RDONLY)) == -1) {
            PLOG_F("Couldn't open /dev/urandom for writing");
        }
    }

    if (rndIni == false) {
        if (files_readFromFd(util_urandomFd, (uint8_t *) & rndX, sizeof(rndX)) == false) {
            PLOG_F("Couldn't read '%zu' bytes from /dev/urandom", sizeof(rndX));
        }
        rndIni = true;
    }

    /* MMIX LCG PRNG */
    static const uint64_t a = 6364136223846793005ULL;
    static const uint64_t c = 1442695040888963407ULL;

    rndX = (a * rndX + c);

    return ((rndX % (max - min + 1)) + min);
}
开发者ID:naisanza,项目名称:honggfuzz,代码行数:27,代码来源:util.c


注:本文中的LOG_F函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。