package heufybot.core;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import heufybot.utils.FileUtils;

public class Logger 
{
	public static void log(String line, String target)
	{
		//Timestamp line
		DateFormat dateFormat = new SimpleDateFormat("[HH:mm]");
		Date date = new Date();
		line = dateFormat.format(date) + " " + line;
		
		//Output to console
		if(target.equals(""))
		{
			System.out.println(line);
		}
		else
		{
			System.out.println(target + " - " + line);
		}
		
		//Output to logfile
		FileUtils.writeFileAppend("test.log", line + "\n");
	}
	
	public static void log(String line)
	{
		log(line, "");
	}
	
	public static void error(String errorSource, String line)
	{
		System.err.println(errorSource + " - ERROR: " + line);
	}
}
package heufybot.core;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

import heufybot.utils.FileUtils;

public class Logger 
{
	public static void log(String line)
	{
		//Timestamp line
		DateFormat dateFormat = new SimpleDateFormat("[HH:mm]");
		Date date = new Date();
		line = dateFormat.format(date) + " " + line;
		
		//Output to console
		System.out.println(line);
		
		//Output to logfile
		FileUtils.writeFileAppend("test.log", line + "\n");
	}
	
	public static void error(String errorSource, String line)
	{
		System.err.println(errorSource + " - ERROR: " + line);
	}
}
--- 
+++ 
@@ -8,7 +8,7 @@
 
 public class Logger 
 {
-	public static void log(String line)
+	public static void log(String line, String target)
 	{
 		//Timestamp line
 		DateFormat dateFormat = new SimpleDateFormat("[HH:mm]");
@@ -16,10 +16,22 @@
 		line = dateFormat.format(date) + " " + line;
 		
 		//Output to console
-		System.out.println(line);
+		if(target.equals(""))
+		{
+			System.out.println(line);
+		}
+		else
+		{
+			System.out.println(target + " - " + line);
+		}
 		
 		//Output to logfile
 		FileUtils.writeFileAppend("test.log", line + "\n");
+	}
+	
+	public static void log(String line)
+	{
+		log(line, "");
 	}
 	
 	public static void error(String errorSource, String line)
Add logging to a target, for creating logfiles for seperate channels
later