This project has retired. For details please refer to its
Attic page.
DefaultJavascriptLogger xref
1 package org.apache.archiva.web.api;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21 import org.apache.archiva.web.model.JavascriptLog;
22 import org.slf4j.Logger;
23 import org.slf4j.LoggerFactory;
24 import org.springframework.stereotype.Service;
25
26
27
28
29
30 @Service("javascriptLogger#default")
31 public class DefaultJavascriptLogger
32 implements JavascriptLogger
33 {
34 private Logger logger = LoggerFactory.getLogger( getClass() );
35
36 @Override
37 public Boolean trace( JavascriptLog javascriptLog )
38 {
39 Logger toUse =
40 javascriptLog.getLoggerName() == null ? logger : LoggerFactory.getLogger( javascriptLog.getLoggerName() );
41 if ( javascriptLog.getMessage() == null )
42 {
43 return Boolean.TRUE;
44 }
45 toUse.trace( javascriptLog.getMessage() );
46 return Boolean.TRUE;
47 }
48
49 @Override
50 public Boolean debug( JavascriptLog javascriptLog )
51 {
52 Logger toUse =
53 javascriptLog.getLoggerName() == null ? logger : LoggerFactory.getLogger( javascriptLog.getLoggerName() );
54
55 if ( javascriptLog.getMessage() == null )
56 {
57 return Boolean.TRUE;
58 }
59
60 toUse.debug( javascriptLog.getMessage() );
61 return Boolean.TRUE;
62 }
63
64 @Override
65 public Boolean info( JavascriptLog javascriptLog )
66 {
67 Logger toUse =
68 javascriptLog.getLoggerName() == null ? logger : LoggerFactory.getLogger( javascriptLog.getLoggerName() );
69
70 if ( javascriptLog.getMessage() == null )
71 {
72 return Boolean.TRUE;
73 }
74
75 toUse.info( javascriptLog.getMessage() );
76 return Boolean.TRUE;
77 }
78
79 @Override
80 public Boolean warn( JavascriptLog javascriptLog )
81 {
82 Logger toUse =
83 javascriptLog.getLoggerName() == null ? logger : LoggerFactory.getLogger( javascriptLog.getLoggerName() );
84
85 if ( javascriptLog.getMessage() == null )
86 {
87 return Boolean.TRUE;
88 }
89
90 toUse.warn( javascriptLog.getMessage() );
91 return Boolean.TRUE;
92 }
93
94 @Override
95 public Boolean error( JavascriptLog javascriptLog )
96 {
97 Logger toUse =
98 javascriptLog.getLoggerName() == null ? logger : LoggerFactory.getLogger( javascriptLog.getLoggerName() );
99
100 if ( javascriptLog.getMessage() == null )
101 {
102 return Boolean.TRUE;
103 }
104
105 toUse.error( javascriptLog.getMessage() );
106 return Boolean.TRUE;
107 }
108 }