本文整理汇总了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());
}
示例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());
}
}
示例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());
}
示例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());
}
示例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);
}
示例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());
}
}
示例7: append
import org.microemu.log.LoggingEvent; //导入依赖的package包/类
public void append(LoggingEvent event) {
lastEvent = event;
}
示例8: getLastEvent
import org.microemu.log.LoggingEvent; //导入依赖的package包/类
public LoggingEvent getLastEvent() {
LoggingEvent ev = lastEvent;
lastEvent = null;
return ev;
}