示例#1
0
bool Tial::Utility::Logger::toBeLoggedRuntime(Level level, const std::experimental::string_view &module) {
	auto moduleLevel = levels.find(module.to_string());
	if(moduleLevel == levels.end()) {
		auto sep = module.rfind("::");
		if(sep == module.npos)
			return level >= globalLevel;

		return toBeLoggedRuntime(level, module.substr(0, sep));
	}
	return level >= moduleLevel->second;
}
示例#2
0
void Tial::Testing::Thread::operator()(const std::experimental::string_view &name) {
	std::promise<void> result;
	this->result = result.get_future();
	thread = std::thread([name=name, function=function, checker=Check::checker()](std::promise<void> result){
		Utility::Thread::setName(name.to_string());
		Check::setChecker(checker);
		try {
			function();
			result.set_value_at_thread_exit();
		} catch(std::exception e) {
			LOGC << "Exception in subthread: " << e.what();
			throw;
		} catch(...) {
			LOGC << "Exception in subthread";
			result.set_exception_at_thread_exit(std::current_exception());
		}
	}, std::move(result));
}
示例#3
0
void Tial::Utility::Logger::setLoggingLevel(Level level, const std::experimental::string_view &module) {
	levels[module.to_string()] = level;
}
示例#4
0
Tial::Utility::Logger::Message::Message(
	const std::experimental::string_view &file, unsigned int line, const std::experimental::string_view &function,
	const std::experimental::string_view &prettyFunction, Level level, const std::experimental::string_view &module,
	const TimePoint &time
): file(file.to_string()), line(line), function(function.to_string()), prettyFunction(prettyFunction.to_string()),
	level(level), module(module.to_string()), time(time) {}