blob: 69e5e65a871c7ed308d9dc06e5f2fee235dde4a2 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
|
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package simpleapdu;
import java.io.FileOutputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author xsvenda
*/
public class DirtyLogger {
FileOutputStream m_logFile;
boolean m_bOutputSystemOut = true;
public DirtyLogger(FileOutputStream logFile, boolean bOutputSystemOut) {
m_logFile = logFile;
m_bOutputSystemOut = bOutputSystemOut;
}
public void println() {
String logLine = "\n";
print(logLine);
}
public void println(String logLine) {
logLine += "\n";
print(logLine);
}
public void print(String logLine) {
if (m_bOutputSystemOut) {
System.out.print(logLine);
}
if (m_logFile != null) {
try {
m_logFile.write(logLine.getBytes());
} catch (IOException ex) {
}
}
}
void flush() {
try {
m_logFile.flush();
} catch (IOException ex) {
}
}
}
|