Created
May 8, 2013 17:48
-
-
Save bigtoast/5542180 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.ticketfly.pillage; | |
import java.io.File; | |
import java.io.FileOutputStream; | |
import java.io.IOException; | |
import java.nio.channels.FileChannel; | |
public class LogfileReporter implements StatsReporter { | |
private File logDirectory; | |
private String now = System.currentTimeMillis() + ".log"; | |
private File logFile; | |
public LogfileReporter( String logDirectoryPath ) { | |
this(new File(logDirectoryPath)); | |
} | |
public LogfileReporter( File logDirectory ) { | |
this.logDirectory = logDirectory; | |
this.logFile = new File(logDirectory.getAbsolutePath() + "/" + now); | |
} | |
@Override | |
public void report(StatsSummary stats) { | |
FileOutputStream out = null; | |
try { | |
out = new FileOutputStream(logFile, true); | |
FileChannel channel = out.getChannel(); | |
} catch ( IOException ex ) { | |
} finally { | |
try { | |
if ( out != null ) | |
out.close(); | |
} catch ( IOException ex ) { | |
// do nothing | |
} | |
} | |
//To change body of implemented methods use File | Settings | File Templates. | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment