public void log(Level level, String msg) {
        try {
            Date date = new Date();
            String log = "[" + level + "]::" + "[" + date.toGMTString() + "] - " + msg + "\n";
            jTextArea1.append(log);
            System.out.println(log);
            writer.write(log);
            writer.flush();
            if (level == Level.ERROR)
                JOptionPane.showMessageDialog(null, msg, "Error: Universal Android Toolkit Logger", JOptionPane.ERROR_MESSAGE);
        } catch (IOException ex) {
            System.err.println("ERROR: Error while logging to file!");
            ex.printStackTrace(System.err);
        }
    }