當前位置: 首頁>>代碼示例>>Java>>正文


Java LoggingEvent類代碼示例

本文整理匯總了Java中org.microemu.log.LoggingEvent的典型用法代碼示例。如果您正苦於以下問題:Java LoggingEvent類的具體用法?Java LoggingEvent怎麽用?Java LoggingEvent使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LoggingEvent類屬於org.microemu.log包,在下文中一共展示了LoggingEvent類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: append

import org.microemu.log.LoggingEvent; //導入依賴的package包/類
public void append(LoggingEvent event) {
	StringBuffer bug = new StringBuffer(formatEventTime(event.getEventTime()));
	if (event.getLevel() == LoggingEvent.ERROR) {
		bug.append("Error:");
	}
	bug.append(event.getMessage());
	if (event.hasData()) {
		bug.append(" [").append(event.getFormatedData()).append("]");
	}
   	String location = formatLocation(event.getLocation());
   	if (location.length() > 0) {
   		bug.append("\n\t  ");
   	}
	bug.append(location);
	if (event.getThrowable() != null) {
		OutputStream out = new ByteArrayOutputStream();
		PrintStream stream = new PrintStream(out);
		event.getThrowable().printStackTrace(stream);
		stream.flush();
		bug.append(out.toString());
	}
	bug.append("\n");
	log(bug.toString());
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:25,代碼來源:SwingLogConsoleDialog.java

示例2: append

import org.microemu.log.LoggingEvent; //導入依賴的package包/類
public void append(LoggingEvent event) {
   	String data = "";
   	if (event.hasData()) {
   		data = " [" + event.getFormatedData() + "]";
   	}
	Log.v(MicroEmulator.LOG_TAG, event.getMessage() + data +  "\n\t  " + formatLocation(event.getLocation()));
   	if (event.getThrowable() != null) {
   		ByteArrayOutputStream baos = new ByteArrayOutputStream();
   		event.getThrowable().printStackTrace(new PrintStream(baos));
   		Log.v(MicroEmulator.LOG_TAG, baos.toString());
   	}

}
 
開發者ID:Helltar,項目名稱:AMPASIDE,代碼行數:14,代碼來源:AndroidLoggerAppender.java

示例3: verify

import org.microemu.log.LoggingEvent; //導入依賴的package包/類
private void verify(LoggingEvent event, StackTraceElement b4call, final String message) {
	assertNotNull("got event", event);
	assertEquals(message, event.getMessage());
	StackTraceElement ste = event.getLocation();
	assertNotNull("Has location info", ste);
	assertEquals("MethodName", b4call.getMethodName(), ste.getMethodName());
	assertEquals("ClassName", b4call.getClassName(), ste.getClassName());
	assertEquals("LineNumber", b4call.getLineNumber() + 1, ste.getLineNumber());
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:10,代碼來源:MIDletOutputStreamRedirectorTest.java

示例4: testApplication

import org.microemu.log.LoggingEvent; //導入依賴的package包/類
public void testApplication() throws Exception {
	ClassLoader parent = MIDletClassLoaderTest.class.getClassLoader();
	URL jarURL = parent.getResource(TEST_APP_JAR);
	assertNotNull("Can't find app jar", jarURL);
	
	System.setProperty("test.verbose", "1");
	
	MIDletSystemProperties.setProperty("test.property1", "1");
	MIDletSystemProperties.setProperty("microedition.platform", null);
	
	MIDletClassLoader.enhanceCatchBlock = false;
	MIDletClassLoader mcl = new MIDletClassLoader(parent);
	mcl.disableClassPreporcessing(Injected.class);
	MIDletResourceLoader.classLoader = mcl;
	mcl.addURL(jarURL);
	
	Class instrumentedClass = mcl.loadClass(TEST_CLASS);
	Runnable instrumentedInstance = (Runnable) instrumentedClass.newInstance();
	instrumentedInstance.run();
	
	LoggingEvent lastEvent = capture.getLastEvent();
	assertNotNull("got event", lastEvent);
	assertEquals("All tests OK", lastEvent.getMessage());
	StackTraceElement ste = lastEvent.getLocation();
	assertEquals("MethodName", "run", ste.getMethodName());
	assertEquals("ClassName", TEST_CLASS, ste.getClassName());

}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:29,代碼來源:MIDletClassLoaderTest.java

示例5: runEnhanceCatchBlock

import org.microemu.log.LoggingEvent; //導入依賴的package包/類
private void runEnhanceCatchBlock(MIDletClassLoader mcl, String name) throws Exception {
	Class instrumentedClass = mcl.loadClass(name);
	Runnable instrumentedInstance = (Runnable) instrumentedClass.newInstance();
	instrumentedInstance.run();
	
	LoggingEvent lastEvent = capture.getLastEvent();
	assertNotNull("got event", lastEvent);
	assertNotNull("got message", lastEvent.getMessage());
	System.out.println("[" +lastEvent.getMessage() + "]");
	assertTrue("error message", lastEvent.getMessage().indexOf("MIDlet caught") != -1);
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:12,代碼來源:MIDletClassLoaderTest.java

示例6: append

import org.microemu.log.LoggingEvent; //導入依賴的package包/類
public void append(LoggingEvent event) {
   	String data = "";
   	if (event.hasData()) {
   		data = " [" + event.getFormatedData() + "]";
   	}
	Log.v(BombusModActivity.LOG_TAG, event.getMessage() + data +  "\n\t  " + formatLocation(event.getLocation()));
   	if (event.getThrowable() != null) {
   		ByteArrayOutputStream baos = new ByteArrayOutputStream();
   		event.getThrowable().printStackTrace(new PrintStream(baos));
   		Log.v(BombusModActivity.LOG_TAG, baos.toString());
   	}

}
 
開發者ID:BombusMod,項目名稱:BombusMod,代碼行數:14,代碼來源:AndroidLoggerAppender.java

示例7: append

import org.microemu.log.LoggingEvent; //導入依賴的package包/類
public void append(LoggingEvent event) {
	lastEvent = event;
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:4,代碼來源:EventCatureLoggerAppender.java

示例8: getLastEvent

import org.microemu.log.LoggingEvent; //導入依賴的package包/類
public LoggingEvent getLastEvent() {
	LoggingEvent ev = lastEvent;
	lastEvent = null;
	return ev;
}
 
開發者ID:freeVM,項目名稱:freeVM,代碼行數:6,代碼來源:EventCatureLoggerAppender.java


注:本文中的org.microemu.log.LoggingEvent類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。