package net.sourceforge.phpdt.sql.view; import java.io.PrintWriter; import java.io.StringWriter; public class LogProxy implements LogConstants { private static LogProxy instance = null; private SQLLogView log = null; private LogProxy() { } public synchronized static LogProxy getInstance() { if (instance == null) { instance = new LogProxy(); } return instance; } public void addText(int type, String text) { log = SQLLogView.getInstance(); if (log != null) { log.addText(type, text); } } public void addText(int type, String text, Exception e) { addText(type, text); StringWriter writer = new StringWriter(); e.printStackTrace(new PrintWriter(writer)); addText(type, writer.toString()); } public void addText(int type, Exception e) { addText(type, "Error occured: " + e, e); //$NON-NLS-1$ } }