forked from codehaus-plexus/plexus-archiver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCapturingLog.java
99 lines (81 loc) · 2.15 KB
/
CapturingLog.java
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
package org.codehaus.plexus.archiver;
import org.codehaus.plexus.logging.AbstractLogger;
import org.codehaus.plexus.logging.Logger;
import java.util.ArrayList;
import java.util.List;
public class CapturingLog extends AbstractLogger
{
public CapturingLog( int threshold, String name )
{
super( threshold, name );
}
static class Message {
public final String message;
public final Throwable throwable;
public Message( String message, Throwable throwable )
{
this.message = message;
this.throwable = throwable;
}
@Override
public String toString()
{
return "Message{" + "message='" + message + '\'' + ", throwable=" + throwable + '}';
}
}
private final List<Message> debugs = new ArrayList<>();
@Override
public void debug( String s, Throwable throwable )
{
debugs.add( new Message( s, throwable ) );
}
public List<Message> getDebugs()
{
return debugs;
}
private final List<Message> infos = new ArrayList<>();
@Override
public void info( String s, Throwable throwable )
{
infos.add( new Message( s, throwable ) );
}
public List<Message> getInfos()
{
return infos;
}
private final List<Message> warns = new ArrayList<>();
@Override
public void warn( String s, Throwable throwable )
{
warns.add( new Message( s, throwable ) );
}
public List<Message> getWarns()
{
return warns;
}
private final List<Message> errors = new ArrayList<>();
@Override
public void error( String s, Throwable throwable )
{
errors.add( new Message( s, throwable ) );
}
public List<Message> getErors()
{
return errors;
}
private final List<Message> fatals = new ArrayList<>();
@Override
public void fatalError( String s, Throwable throwable )
{
fatals.add( new Message( s, throwable ) );
}
public List<Message> getFatals()
{
return fatals;
}
@Override
public Logger getChildLogger( String s )
{
return null;
}
}