示例#1
0
void ofLogger::setTopicLogLevel(const string& logTopic, ofLogLevel logLevel){
	Poco::Logger* topicLogger = Poco::Logger::has(logTopic);
	if(topicLogger){
		topicLogger->setLevel(logLevel);
	}
	else{
		log(OF_LOG_WARNING, "log topic \""+logTopic+"\" not found");
	}
}
示例#2
0
void MQException::log(Poco::Logger& logger) const
{
	if ( _code == MQCC_WARNING )
	{
		logger.warning(message());
	}
	else
	{
		logger.error(message());
	}
}
void ConsoleWrapper::trace(const v8::FunctionCallbackInfo<v8::Value>& args)
{
	std::string text("Stack Trace:")	;
	v8::HandleScope scope(args.GetIsolate());
	v8::Local<v8::StackTrace> stackTrace = v8::StackTrace::CurrentStackTrace(args.GetIsolate(), 128, v8::StackTrace::kDetailed);
	for (int i = 0; i < stackTrace->GetFrameCount(); i++)
	{
		text.append("\n  Frame #");
		Poco::NumberFormatter::append(text, i);
		v8::Local<v8::StackFrame> frame = stackTrace->GetFrame(i);

		v8::Local<v8::String> function = frame->GetFunctionName();
		if (!function.IsEmpty())
		{
			std::string functionName(toString(frame->GetFunctionName()));
			if (!functionName.empty())
			{
				text.append(" ");
				text.append(functionName);
				text.append("()");
			}
		}
		text.append(" at ");
		v8::Local<v8::String> script = frame->GetScriptNameOrSourceURL();
		if (script.IsEmpty())
		{
			text.append("<unknown>");
		}
		else
		{
			text.append("\"");
			text.append(toString(script));
			text.append("\"");
		}
		if (frame->GetLineNumber() > 0)
		{
			text.append(", line ");
			Poco::NumberFormatter::append(text, frame->GetLineNumber());
		}
	}
	Poco::Logger* pLogger = Wrapper::unwrapNative<Poco::Logger>(args);
	pLogger->debug(text);
}
	void shutdown(Poco::Net::WebSocket& webSocket, Poco::UInt16 statusCode, Poco::Logger& logger)
	{
		try
		{
			webSocket.shutdown(statusCode);
			webSocket.shutdownSend();
		}
		catch (Poco::Exception& exc)
		{
			logger.warning(Poco::format("Error shutting down WebSocket: %s", exc.displayText()));
		}
	}