1. Project Clover database Tue Dec 20 2016 21:24:09 CET
  2. Package org.xwiki.logging.event

File LoggerListener.java

 

Coverage histogram

../../../../img/srcFileCovDistChart8.png
54% of files have more coverage

Code metrics

0
5
4
1
72
27
4
0.8
1.25
4
1

Classes

Class Line # Actions
LoggerListener 31 5 0% 4 2
0.777777877.8%
 

Contributing tests

This file is covered by 145 tests. .

Source view

1    /*
2    * See the NOTICE file distributed with this work for additional
3    * information regarding copyright ownership.
4    *
5    * This is free software; you can redistribute it and/or modify it
6    * under the terms of the GNU Lesser General Public License as
7    * published by the Free Software Foundation; either version 2.1 of
8    * the License, or (at your option) any later version.
9    *
10    * This software is distributed in the hope that it will be useful,
11    * but WITHOUT ANY WARRANTY; without even the implied warranty of
12    * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13    * Lesser General Public License for more details.
14    *
15    * You should have received a copy of the GNU Lesser General Public
16    * License along with this software; if not, write to the Free
17    * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
18    * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
19    */
20    package org.xwiki.logging.event;
21   
22    import org.xwiki.logging.Logger;
23    import org.xwiki.observation.event.Event;
24   
25    /**
26    * Redirect all received event to the provided {@link Logger}.
27    *
28    * @version $Id: 6e1be8cb3d70c398798431cfb28b792413e5633c $
29    * @since 5.4M1
30    */
 
31    public class LoggerListener extends AbstractLogEventListener
32    {
33    /**
34    * The name of the listener.
35    */
36    private String name;
37   
38    /**
39    * The logger where to send received events.
40    */
41    private Logger logger;
42   
43    /**
44    * @param name the name of the listener
45    * @param logger the queue where to store received {@link LogEvent}s
46    */
 
47  587 toggle public LoggerListener(String name, Logger logger)
48    {
49  587 this.name = name;
50  587 this.logger = logger;
51    }
52   
 
53  3905 toggle @Override
54    public String getName()
55    {
56  3905 return this.name;
57    }
58   
59    /**
60    * @return the logger
61    */
 
62  0 toggle public Logger getLogger()
63    {
64  0 return this.logger;
65    }
66   
 
67  4073 toggle @Override
68    public void onEvent(Event event, Object source, Object data)
69    {
70  4073 this.logger.log((LogEvent) event);
71    }
72    }