当前位置: 首页>>代码示例>>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;未经允许,请勿转载。