// Path: src/main/java/com/dcp/sm/main/log/Out.java
// public class Out
// {
//     //Log
//     private static List<String> log = new ArrayList<String>();//Global Log
//     public static List<String> getLog() { return log; }
//     private static int displayLevel = 1;//logs to display must be >= than this
//     
//     private static List<String> compileLog = new ArrayList<String>();//Izpack compile Log
//     public static List<String> getCompileLog() { return compileLog; }
//     
//     //Pivot GUI Component Repaint for log update
//     private static Component logger = null;
//     public static Component getLogger() { return logger; }
//     public static void setLogger(Component logger) { Out.logger = logger; }
//     
//     //Clear the stream cache
//     public static void clearCompileLog() {
//         compileLog.clear();
//     }
//     
//     //Add a new empty line
//     public static void newLine() {
//         print(LOG_LEVEL.INFO, "");
//     }
//     
//     /**
//      * Prints a string to the output stream
//      * @param text: log text
//      * @param outStream: output stream
//      */
//     public static void print(String text, PrintStream outStream) {
//         outStream.println(text);
//     }
//     
//     /**
//      * print text with a tag
//      * format: [TAG] TXT
//      * @param TAG: tag name
//      * @param TXT: text to log
//      */
//     public static void print(LOG_LEVEL level, String msg) {
//         print("["+level.toString()+"] "+msg, System.out);
//         log.add(msg);
//         final String log_TXT = msg;
//         
//         if (level.value() >= displayLevel)// display if >= than threshold
//             log(log_TXT);
//     }
//     
//     public static void log(final String msg) {
//         ApplicationContext.queueCallback(new Runnable() {//Enqueue GUI display repaint
//             @Override public void run()
//             {
//                 compileLog.add(msg);
//                 if (getLogger() != null) getLogger().repaint();//Component update
//             }
//         });
//     }
//     
// }


import java.io.File;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectHelper;
import com.dcp.sm.main.log.Out;
        project.addBuildListener(consoleLogger);
        
        //Log using Out class
        project.addBuildListener(new BuildListener() {
            
            @Override
            public void taskStarted(BuildEvent ev)
            { }
            
            @Override
            public void taskFinished(BuildEvent ev)
            { }
            
            @Override
            public void targetStarted(BuildEvent ev)
            { }
            
            @Override
            public void targetFinished(BuildEvent ev)
            { }
            
            @Override
            public void messageLogged(BuildEvent ev)
            {
                if (ev.getPriority() == Project.MSG_INFO ||
                    //ev.getPriority() == Project.MSG_VERBOSE ||
                    ev.getPriority() == Project.MSG_WARN ||
                    ev.getPriority() == Project.MSG_ERR)
                    Out.log(log_tag.toLowerCase()+"> "+ev.getMessage());
                else
// Path: src/main/java/com/dcp/sm/main/log/Out.java
// public class Out
// {
//     //Log
//     private static List<String> log = new ArrayList<String>();//Global Log
//     public static List<String> getLog() { return log; }
//     private static int displayLevel = 1;//logs to display must be >= than this
//     
//     private static List<String> compileLog = new ArrayList<String>();//Izpack compile Log
//     public static List<String> getCompileLog() { return compileLog; }
//     
//     //Pivot GUI Component Repaint for log update
//     private static Component logger = null;
//     public static Component getLogger() { return logger; }
//     public static void setLogger(Component logger) { Out.logger = logger; }
//     
//     //Clear the stream cache
//     public static void clearCompileLog() {
//         compileLog.clear();
//     }
//     
//     //Add a new empty line
//     public static void newLine() {
//         print(LOG_LEVEL.INFO, "");
//     }
//     
//     /**
//      * Prints a string to the output stream
//      * @param text: log text
//      * @param outStream: output stream
//      */
//     public static void print(String text, PrintStream outStream) {
//         outStream.println(text);
//     }
//     
//     /**
//      * print text with a tag
//      * format: [TAG] TXT
//      * @param TAG: tag name
//      * @param TXT: text to log
//      */
//     public static void print(LOG_LEVEL level, String msg) {
//         print("["+level.toString()+"] "+msg, System.out);
//         log.add(msg);
//         final String log_TXT = msg;
//         
//         if (level.value() >= displayLevel)// display if >= than threshold
//             log(log_TXT);
//     }
//     
//     public static void log(final String msg) {
//         ApplicationContext.queueCallback(new Runnable() {//Enqueue GUI display repaint
//             @Override public void run()
//             {
//                 compileLog.add(msg);
//                 if (getLogger() != null) getLogger().repaint();//Component update
//             }
//         });
//     }
//     
// }


// Path: src/main/java/com/dcp/sm/config/compile/AntCompiler.java
import java.io.File;
import org.apache.tools.ant.BuildEvent;
import org.apache.tools.ant.BuildListener;
import org.apache.tools.ant.DefaultLogger;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.ProjectHelper;
import com.dcp.sm.main.log.Out;

        project.addBuildListener(consoleLogger);
        
        //Log using Out class
        project.addBuildListener(new BuildListener() {
            
            @Override
            public void taskStarted(BuildEvent ev)
            { }
            
            @Override
            public void taskFinished(BuildEvent ev)
            { }
            
            @Override
            public void targetStarted(BuildEvent ev)
            { }
            
            @Override
            public void targetFinished(BuildEvent ev)
            { }
            
            @Override
            public void messageLogged(BuildEvent ev)
            {
                if (ev.getPriority() == Project.MSG_INFO ||
                    //ev.getPriority() == Project.MSG_VERBOSE ||
                    ev.getPriority() == Project.MSG_WARN ||
                    ev.getPriority() == Project.MSG_ERR)
                    Out.log(log_tag.toLowerCase()+"> "+ev.getMessage());
                else
                    Out.print("[DEBUG] "+ev.getMessage(), System.out);