// Path: src/org/sleeksnap/util/logging/FileLogHandler.java
// public class FileLogHandler extends java.util.logging.Handler {
// 
// 	/**
// 	 * The buffered writer for this logger
// 	 */
// 	private BufferedWriter writer;
// 
// 	/**
// 	 * A simple file logger!
// 	 */
// 	public FileLogHandler() {
// 		configure();
// 	}
// 
// 	/**
// 	 * Configure the logger
// 	 */
// 	private void configure() {
// 		File file = new File(Util.getWorkingDirectory(), "log.txt");
// 		try {
// 			writer = new BufferedWriter(new FileWriter(file));
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	@Override
// 	public void publish(LogRecord record) {
// 		if (getFormatter() == null)
// 			setFormatter(new SimpleFormatter());
// 		if (!isLoggable(record)) {
// 			return;
// 		}
// 		try {
// 			writer.write(getFormatter().format(record));
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 		flush();
// 	}
// 
// 	@Override
// 	public void flush() {
// 		try {
// 			writer.flush();
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	@Override
// 	public void close() throws SecurityException {
// 		try {
// 			writer.close();
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// }
// 
// Path: src/org/sleeksnap/util/logging/LogPanelHandler.java
// public class LogPanelHandler extends java.util.logging.Handler {
// 
// 	private static LogPanel logPanel;
// 
// 	/**
// 	 * A simple file logger!
// 	 */
// 	public LogPanelHandler() {
// 	}
// 
// 	@Override
// 	public void publish(LogRecord record) {
// 		if(logPanel == null) {
// 			return;
// 		}
// 		if (getFormatter() == null)
// 			setFormatter(new SimpleFormatter());
// 		
// 		if (!isLoggable(record))
// 			return;
// 		
// 		logPanel.appendLog(getFormatter().format(record));
// 	}
// 
// 	@Override
// 	public void flush() {
// 	}
// 
// 	@Override
// 	public void close() throws SecurityException {
// 	}
// 
// 	/**
// 	 * Bind this logging handler to a LogPanel instance to update the log screen
// 	 * @param logPanel
// 	 * 			The panel to bind
// 	 */
// 	public static void bindTo(LogPanel logPanel) {
// 		LogPanelHandler.logPanel = logPanel;
// 	}
// 
// 	/**
// 	 * Unbind the LogPanel instance (Always done when the settings gui is closed)
// 	 */
// 	public static void unbind() {
// 		LogPanelHandler.logPanel = null;
// 	}
// }


import java.io.IOException;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import org.sleeksnap.util.logging.FileLogHandler;
import org.sleeksnap.util.logging.LogPanelHandler;
/**
 * Sleeksnap, the open source cross-platform screenshot uploader
 * Copyright (C) 2012 Nikki <nikki@nikkii.us>
 *
 * 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.sleeksnap.impl;



/**
 * A class to load the logging properties of this application, allows the use of
 * file logging for the Log panel
 * 
 * @author Nikki
 * 
 */
public class LoggingManager {
	
	/**
	 * Load the configuration from a byte array
	 * @throws IOException 
	 */
	@SuppressWarnings("unchecked")
	public static void configure() throws IOException {
		LoggerConfiguration config = new LoggerConfiguration();
// Path: src/org/sleeksnap/util/logging/FileLogHandler.java
// public class FileLogHandler extends java.util.logging.Handler {
// 
// 	/**
// 	 * The buffered writer for this logger
// 	 */
// 	private BufferedWriter writer;
// 
// 	/**
// 	 * A simple file logger!
// 	 */
// 	public FileLogHandler() {
// 		configure();
// 	}
// 
// 	/**
// 	 * Configure the logger
// 	 */
// 	private void configure() {
// 		File file = new File(Util.getWorkingDirectory(), "log.txt");
// 		try {
// 			writer = new BufferedWriter(new FileWriter(file));
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	@Override
// 	public void publish(LogRecord record) {
// 		if (getFormatter() == null)
// 			setFormatter(new SimpleFormatter());
// 		if (!isLoggable(record)) {
// 			return;
// 		}
// 		try {
// 			writer.write(getFormatter().format(record));
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 		flush();
// 	}
// 
// 	@Override
// 	public void flush() {
// 		try {
// 			writer.flush();
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// 
// 	@Override
// 	public void close() throws SecurityException {
// 		try {
// 			writer.close();
// 		} catch (IOException e) {
// 			e.printStackTrace();
// 		}
// 	}
// }
// 
// Path: src/org/sleeksnap/util/logging/LogPanelHandler.java
// public class LogPanelHandler extends java.util.logging.Handler {
// 
// 	private static LogPanel logPanel;
// 
// 	/**
// 	 * A simple file logger!
// 	 */
// 	public LogPanelHandler() {
// 	}
// 
// 	@Override
// 	public void publish(LogRecord record) {
// 		if(logPanel == null) {
// 			return;
// 		}
// 		if (getFormatter() == null)
// 			setFormatter(new SimpleFormatter());
// 		
// 		if (!isLoggable(record))
// 			return;
// 		
// 		logPanel.appendLog(getFormatter().format(record));
// 	}
// 
// 	@Override
// 	public void flush() {
// 	}
// 
// 	@Override
// 	public void close() throws SecurityException {
// 	}
// 
// 	/**
// 	 * Bind this logging handler to a LogPanel instance to update the log screen
// 	 * @param logPanel
// 	 * 			The panel to bind
// 	 */
// 	public static void bindTo(LogPanel logPanel) {
// 		LogPanelHandler.logPanel = logPanel;
// 	}
// 
// 	/**
// 	 * Unbind the LogPanel instance (Always done when the settings gui is closed)
// 	 */
// 	public static void unbind() {
// 		LogPanelHandler.logPanel = null;
// 	}
// }


// Path: src/org/sleeksnap/impl/LoggingManager.java
import java.io.IOException;
import java.util.logging.ConsoleHandler;
import java.util.logging.Level;
import org.sleeksnap.util.logging.FileLogHandler;
import org.sleeksnap.util.logging.LogPanelHandler;

/**
 * Sleeksnap, the open source cross-platform screenshot uploader
 * Copyright (C) 2012 Nikki <nikki@nikkii.us>
 *
 * 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.sleeksnap.impl;



/**
 * A class to load the logging properties of this application, allows the use of
 * file logging for the Log panel
 * 
 * @author Nikki
 * 
 */
public class LoggingManager {
	
	/**
	 * Load the configuration from a byte array
	 * @throws IOException 
	 */
	@SuppressWarnings("unchecked")
	public static void configure() throws IOException {
		LoggerConfiguration config = new LoggerConfiguration();
		config.addHandlers(ConsoleHandler.class, FileLogHandler.class, LogPanelHandler.class);