@Override public void log( Temporal t, LogicalDateTime d, LogLevels level, Object obj, String function, String message, Object... args) { try { fw.write( String.format( t.toString() + sep + d + sep + level + sep + obj + sep + function + sep + message, args)); fw.write("\n"); fw.flush(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
@Override public void log( ScenarioId scenarioId, Temporal t, LogicalDateTime d, LogLevels level, Object obj, String function, String message, Object... args) { if (!level.equals(LogLevels.data)) { StackTraceElement el = Thread.currentThread().getStackTrace()[8]; String elTxt = "(" + el.getFileName() + ":" + el.getLineNumber() + ")>" + el.getMethodName(); ps.printf(message, args); String[] s; if (d == null) { if (obj != null) s = new String[] { scenarioId.getScenarioId(), Long.toString(scenarioId.getRepliqueNumber()), t.toString(), "", level.toString(), obj.toString(), elTxt, baos.toString() }; else s = new String[] { scenarioId.getScenarioId(), Long.toString(scenarioId.getRepliqueNumber()), t.toString(), "", level.toString(), "", elTxt, baos.toString() }; } else { if (obj != null) s = new String[] { scenarioId.getScenarioId(), Long.toString(scenarioId.getRepliqueNumber()), t.toString(), d.toString(), level.toString(), obj.toString(), elTxt, baos.toString() }; else s = new String[] { scenarioId.getScenarioId(), Long.toString(scenarioId.getRepliqueNumber()), t.toString(), d.toString(), level.toString(), "", elTxt, baos.toString() }; } baos.reset(); Logs l = new Logs(s); createRowFrom(l); } else { if (IRecordable.class.isAssignableFrom(obj.getClass())) { DataLogs dl = new DataLogs(scenarioId, t.toString(), d.toString(), obj.toString(), (IRecordable) obj); createRowFrom(dl); } } }