public static void logMessage(int logLevel, String message) {
		// If it is not important enough for us then do not print it
		if (logLevel > log_level)
			return;
		
		// We should not have an empty logfile
		if (logfile == null || logfile.equals(""))
			return;
		
		// Open file to prepare a print
		PrintWriter pw;
		try {
			pw = new PrintWriter(new BufferedWriter(new FileWriter(logfile, true)));
		} catch (IOException e) {
			e.printStackTrace();
			return;
		}
		
		// Get the current time
		String time = new SimpleDateFormat("yyyy-MM-dd HH-mm-ss").format(Calendar.getInstance().getTime());
		
		// Append line to file
		pw.println(time + " " + message);
		
		// Close the stream
		pw.close();
	}