Skip to content

Commit

Permalink
Add MSPSim Logging
Browse files Browse the repository at this point in the history
  • Loading branch information
cmorty committed Aug 20, 2013
1 parent a07d332 commit 2b5f3bc
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tools/cooja/apps/mspsim/src/se/sics/cooja/mspmote/MspMote.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@
import se.sics.mspsim.cli.LineListener;
import se.sics.mspsim.cli.LineOutputStream;
import se.sics.mspsim.core.EmulationException;
import se.sics.mspsim.core.LogListener;
import se.sics.mspsim.core.Loggable;
import se.sics.mspsim.core.MSP430;
import se.sics.mspsim.core.EmulationLogger.WarningType;
import se.sics.mspsim.platform.GenericNode;
import se.sics.mspsim.ui.ManagedWindow;
import se.sics.mspsim.ui.WindowManager;
Expand Down Expand Up @@ -210,6 +213,21 @@ protected void prepareMote(File fileELF, GenericNode node) throws IOException {
this.myCpu = node.getCPU();
this.myCpu.setMonitorExec(true);
this.myCpu.setTrace(0); /* TODO Enable */

LogListener ll = new LogListener() {
private Logger mlogger = Logger.getLogger("MSPSim");
@Override
public void log(Loggable source, String message) {
mlogger.debug("" + getID() + ": " + source.getID() + ": " + message);
}

@Override
public void logw(Loggable source, WarningType type, String message) throws EmulationException {
mlogger.warn("" + getID() +": " + "# " + source.getID() + "[" + type + "]: " + message);
}
};

this.myCpu.getLogger().addLogListener(ll);

logger.info("Loading firmware from: " + fileELF.getAbsolutePath());
GUI.setProgressMessage("Loading " + fileELF.getName());
Expand Down

0 comments on commit 2b5f3bc

Please sign in to comment.