/*
* Copyright (C) 2015 Vinu K.N
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.domainmath.gui.Util;
import java.io.File;
import org.domainmath.gui.MainFrame;
/**
* Handle Octave log.
* @author Vinu K.N
*/
public class DMILogger {
public static String file = System.getProperty("user.dir")+File.separator+"log"+File.separator+"octave_log.txt";
/**
* Simple Error log for internal purpose.
* @param err
*/
public static void error(String err){
MainFrame.octavePanel.evaluate("Logger('"+file+"',0,'"+err+");");
}
/**
* Simple Warning log for internal purpose.
* @param text
*/
public static void warn(String text){
MainFrame.octavePanel.evaluate("Logger('"+file+"',0,'"+text+");");
}
/**
* Simple Error log for internal purpose.
* @param text
*/
public static void msg(String text){
MainFrame.octavePanel.evaluate("Logger('"+file+"',0,'"+text+"');");
}
public static void error(String file,String text,String id){
MainFrame.octavePanel.evaluate("DMILOG('"+file+"',0,'"+text+"','"+id+"');");
}
public static void warn(String file,String text,String id){
MainFrame.octavePanel.evaluate("DMILOG('"+file+"',1,'"+text+"','"+id+"');");
}
public static void msg(String file,String text,String id){
MainFrame.octavePanel.evaluate("DMILOG('"+file+"',2,'"+text+"','"+id+"');");
}
}