EMMA Coverage Report (generated Tue Oct 27 11:32:50 PDT 2009)
[all classes][net.spy.memcached.compat.log]

COVERAGE SUMMARY FOR SOURCE FILE [Log4JLogger.java]

nameclass, %method, %block, %line, %
Log4JLogger.java0%   (0/2)0%   (0/5)0%   (0/108)0%   (0/21)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class Log4JLogger0%   (0/1)0%   (0/4)0%   (0/68)0%   (0/21)
Log4JLogger (String): void 0%   (0/1)0%   (0/8)0%   (0/3)
isDebugEnabled (): boolean 0%   (0/1)0%   (0/4)0%   (0/1)
isInfoEnabled (): boolean 0%   (0/1)0%   (0/4)0%   (0/1)
log (Level, Object, Throwable): void 0%   (0/1)0%   (0/52)0%   (0/16)
     
class Log4JLogger$10%   (0/1)0%   (0/1)0%   (0/40)0%   (0/1)
<static initializer> 0%   (0/1)0%   (0/40)0%   (0/1)

1// Copyright (c) 2002  Dustin Sallings <dustin@spy.net>
2 
3package net.spy.memcached.compat.log;
4 
5/**
6 * Logging implementation using
7 * <a href="http://jakarta.apache.org/log4j/docs/">log4j</a>.
8 */
9public class Log4JLogger extends AbstractLogger {
10 
11        // Can't really import this without confusion as there's another thing
12        // by this name in here.
13        private final org.apache.log4j.Logger l4jLogger;
14 
15        /**
16         * Get an instance of Log4JLogger.
17         */
18        public Log4JLogger(String name) {
19                super(name);
20 
21                // Get the log4j logger instance.
22                l4jLogger=org.apache.log4j.Logger.getLogger(name);
23        }
24 
25        /**
26         * True if the underlying logger would allow debug messages through.
27         */
28        @Override
29        public boolean isDebugEnabled() {
30                return(l4jLogger.isDebugEnabled());
31        }
32 
33        /**
34         * True if the underlying logger would allow info messages through.
35         */
36        @Override
37        public boolean isInfoEnabled() {
38                return(l4jLogger.isInfoEnabled());
39        }
40 
41        /**
42         * Wrapper around log4j.
43         *
44         * @param level net.spy.compat.log.AbstractLogger level.
45         * @param message object message
46         * @param e optional throwable
47         */
48        @Override
49        public void log(Level level, Object message, Throwable e) {
50                org.apache.log4j.Level pLevel=org.apache.log4j.Level.DEBUG;
51 
52                switch(level == null ? Level.FATAL : level) {
53                        case DEBUG:
54                                pLevel=org.apache.log4j.Level.DEBUG;
55                                break;
56                        case INFO:
57                                pLevel=org.apache.log4j.Level.INFO;
58                                break;
59                        case WARN:
60                                pLevel=org.apache.log4j.Level.WARN;
61                                break;
62                        case ERROR:
63                                pLevel=org.apache.log4j.Level.ERROR;
64                                break;
65                        case FATAL:
66                                pLevel=org.apache.log4j.Level.FATAL;
67                                break;
68                        default:
69                                // I don't know what this is, so consider it fatal
70                                pLevel=org.apache.log4j.Level.FATAL;
71                                l4jLogger.log("net.spy.compat.log.AbstractLogger", pLevel,
72                                        "Unhandled log level:  " + level
73                                                + " for the following message", null);
74                }
75 
76                l4jLogger.log("net.spy.compat.log.AbstractLogger", pLevel, message, e);
77        }
78 
79}

[all classes][net.spy.memcached.compat.log]
EMMA 2.0.5312 (C) Vladimir Roubtsov