private static PrintStream getStream(String type) {
		if (type == null) return null;
		
		if (type.equals("stdout")) {
			return System.out;
		} else if (type.equals("stderr")) {
			return System.err;
		} else if (type.startsWith("file:")) {
			String relativeDir = Settings.get(Settings.DEBUG_DIR);
			try {
				return new PrintStream(new FileOutputStream(relativeDir + "/" + type.substring(5)));
			} catch (FileNotFoundException e) {
				System.out.println("WARNING: Cannot log to file: " + relativeDir + "/" + type.substring(5) + ", Redirecting to sysout");
				return System.out;
			}
		}
		
		return null;
	}