001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portal.kernel.log;
016    
017    import java.util.logging.Level;
018    import java.util.logging.Logger;
019    
020    /**
021     * @author Brian Wing Shun Chan
022     */
023    public class Jdk14LogImpl implements Log {
024    
025            public Jdk14LogImpl(Logger log) {
026                    _log = log;
027            }
028    
029            @Override
030            public void debug(Object msg) {
031                    _log.log(Level.FINE, msg.toString());
032            }
033    
034            @Override
035            public void debug(Object msg, Throwable t) {
036                    _log.log(Level.FINE, msg.toString(), t);
037            }
038    
039            @Override
040            public void debug(Throwable t) {
041                    _log.log(Level.FINE, t.getMessage(), t);
042            }
043    
044            @Override
045            public void error(Object msg) {
046                    _log.log(Level.SEVERE, msg.toString());
047            }
048    
049            @Override
050            public void error(Object msg, Throwable t) {
051                    _log.log(Level.SEVERE, msg.toString(), t);
052            }
053    
054            @Override
055            public void error(Throwable t) {
056                    _log.log(Level.SEVERE, t.getMessage(), t);
057            }
058    
059            @Override
060            public void fatal(Object msg) {
061                    _log.log(Level.SEVERE, msg.toString());
062            }
063    
064            @Override
065            public void fatal(Object msg, Throwable t) {
066                    _log.log(Level.SEVERE, msg.toString(), t);
067            }
068    
069            @Override
070            public void fatal(Throwable t) {
071                    _log.log(Level.SEVERE, t.getMessage(), t);
072            }
073    
074            @Override
075            public void info(Object msg) {
076                    _log.log(Level.INFO, msg.toString());
077            }
078    
079            @Override
080            public void info(Object msg, Throwable t) {
081                    _log.log(Level.INFO, msg.toString(), t);
082            }
083    
084            @Override
085            public void info(Throwable t) {
086                    _log.log(Level.INFO, t.getMessage(), t);
087            }
088    
089            @Override
090            public boolean isDebugEnabled() {
091                    return _log.isLoggable(Level.FINE);
092            }
093    
094            @Override
095            public boolean isErrorEnabled() {
096                    return _log.isLoggable(Level.SEVERE);
097            }
098    
099            @Override
100            public boolean isFatalEnabled() {
101                    return _log.isLoggable(Level.SEVERE);
102            }
103    
104            @Override
105            public boolean isInfoEnabled() {
106                    return _log.isLoggable(Level.INFO);
107            }
108    
109            @Override
110            public boolean isTraceEnabled() {
111                    return _log.isLoggable(Level.FINEST);
112            }
113    
114            @Override
115            public boolean isWarnEnabled() {
116                    return _log.isLoggable(Level.WARNING);
117            }
118    
119            @Override
120            public void trace(Object msg) {
121                    _log.log(Level.FINEST, msg.toString());
122            }
123    
124            @Override
125            public void trace(Object msg, Throwable t) {
126                    _log.log(Level.FINEST, msg.toString(), t);
127            }
128    
129            @Override
130            public void trace(Throwable t) {
131                    _log.log(Level.FINEST, t.getMessage(), t);
132            }
133    
134            @Override
135            public void warn(Object msg) {
136                    _log.log(Level.WARNING, msg.toString());
137            }
138    
139            @Override
140            public void warn(Object msg, Throwable t) {
141                    _log.log(Level.WARNING, msg.toString(), t);
142            }
143    
144            @Override
145            public void warn(Throwable t) {
146                    _log.log(Level.WARNING, t.getMessage(), t);
147            }
148    
149            private Logger _log;
150    
151    }