This project has retired. For details please refer to its
Attic page.
Slf4JPlexusLogger xref
1 package org.apache.archiva.common.utils;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
24
25
26
27
28
29
30
31 public class Slf4JPlexusLogger
32 implements org.codehaus.plexus.logging.Logger
33 {
34 private final Logger log;
35
36 public Slf4JPlexusLogger( Class<?> clazz )
37 {
38 log = LoggerFactory.getLogger( clazz );
39 }
40
41 public Slf4JPlexusLogger( String name )
42 {
43 log = LoggerFactory.getLogger( name );
44 }
45
46 @Override
47 public void debug( String message )
48 {
49 log.debug( message );
50 }
51
52 @Override
53 public void debug( String message, Throwable throwable )
54 {
55 log.debug( message, throwable );
56 }
57
58 @Override
59 public void error( String message )
60 {
61 log.error( message );
62 }
63
64 @Override
65 public void error( String message, Throwable throwable )
66 {
67 log.error( message, throwable );
68 }
69
70 @Override
71 public void fatalError( String message )
72 {
73 log.error( message );
74 }
75
76 @Override
77 public void fatalError( String message, Throwable throwable )
78 {
79 log.error( message, throwable );
80 }
81
82 @Override
83 public org.codehaus.plexus.logging.Logger getChildLogger( String name )
84 {
85 return new Slf4JPlexusLogger( log.getName() + "." + name );
86 }
87
88 @Override
89 public String getName()
90 {
91 return log.getName();
92 }
93
94 @Override
95 public int getThreshold()
96 {
97 if ( log.isTraceEnabled() )
98 {
99 return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
100 }
101 else if ( log.isDebugEnabled() )
102 {
103 return org.codehaus.plexus.logging.Logger.LEVEL_DEBUG;
104 }
105 else if ( log.isInfoEnabled() )
106 {
107 return org.codehaus.plexus.logging.Logger.LEVEL_INFO;
108 }
109 else if ( log.isWarnEnabled() )
110 {
111 return org.codehaus.plexus.logging.Logger.LEVEL_WARN;
112 }
113 else if ( log.isErrorEnabled() )
114 {
115 return org.codehaus.plexus.logging.Logger.LEVEL_ERROR;
116 }
117
118 return org.codehaus.plexus.logging.Logger.LEVEL_DISABLED;
119 }
120
121 @Override
122 public void info( String message )
123 {
124 log.info( message );
125 }
126
127 @Override
128 public void info( String message, Throwable throwable )
129 {
130 log.info( message, throwable );
131 }
132
133 @Override
134 public boolean isDebugEnabled()
135 {
136 return log.isDebugEnabled();
137 }
138
139 @Override
140 public boolean isErrorEnabled()
141 {
142 return log.isErrorEnabled();
143 }
144
145 @Override
146 public boolean isFatalErrorEnabled()
147 {
148 return log.isErrorEnabled();
149 }
150
151 @Override
152 public boolean isInfoEnabled()
153 {
154 return log.isInfoEnabled();
155 }
156
157 @Override
158 public boolean isWarnEnabled()
159 {
160 return log.isWarnEnabled();
161 }
162
163 @Override
164 public void setThreshold( int threshold )
165 {
166
167 }
168
169 @Override
170 public void warn( String message )
171 {
172 log.warn( message );
173 }
174
175 @Override
176 public void warn( String message, Throwable throwable )
177 {
178 log.warn( message, throwable );
179 }
180 }