001    /**
002     * Copyright (c) 2000-2010 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            public void debug(Object msg) {
030                    _log.log(Level.FINE, msg.toString());
031            }
032    
033            public void debug(Throwable t) {
034                    _log.log(Level.FINE, t.getMessage(), t);
035            }
036    
037            public void debug(Object msg, Throwable t) {
038                    _log.log(Level.FINE, msg.toString(), t);
039            }
040    
041            public void error(Object msg) {
042                    _log.log(Level.SEVERE, msg.toString());
043            }
044    
045            public void error(Throwable t) {
046                    _log.log(Level.SEVERE, t.getMessage(), t);
047            }
048    
049            public void error(Object msg, Throwable t) {
050                    _log.log(Level.SEVERE, msg.toString(), t);
051            }
052    
053            public void fatal(Object msg) {
054                    _log.log(Level.SEVERE, msg.toString());
055            }
056    
057            public void fatal(Throwable t) {
058                    _log.log(Level.SEVERE, t.getMessage(), t);
059            }
060    
061            public void fatal(Object msg, Throwable t) {
062                    _log.log(Level.SEVERE, msg.toString(), t);
063            }
064    
065            public void info(Object msg) {
066                    _log.log(Level.INFO, msg.toString());
067            }
068    
069            public void info(Throwable t) {
070                    _log.log(Level.INFO, t.getMessage(), t);
071            }
072    
073            public void info(Object msg, Throwable t) {
074                    _log.log(Level.INFO, msg.toString(), t);
075            }
076    
077            public boolean isDebugEnabled() {
078                    return _log.isLoggable(Level.FINE);
079            }
080    
081            public boolean isErrorEnabled() {
082                    return _log.isLoggable(Level.SEVERE);
083            }
084    
085            public boolean isFatalEnabled() {
086                    return _log.isLoggable(Level.SEVERE);
087            }
088    
089            public boolean isInfoEnabled() {
090                    return _log.isLoggable(Level.INFO);
091            }
092    
093            public boolean isTraceEnabled() {
094                    return _log.isLoggable(Level.FINEST);
095            }
096    
097            public boolean isWarnEnabled() {
098                    return _log.isLoggable(Level.WARNING);
099            }
100    
101            public void trace(Object msg) {
102                    _log.log(Level.FINEST, msg.toString());
103            }
104    
105            public void trace(Throwable t) {
106                    _log.log(Level.FINEST, t.getMessage(), t);
107            }
108    
109            public void trace(Object msg, Throwable t) {
110                    _log.log(Level.FINEST, msg.toString(), t);
111            }
112    
113            public void warn(Object msg) {
114                    _log.log(Level.WARNING, msg.toString());
115            }
116    
117            public void warn(Throwable t) {
118                    _log.log(Level.WARNING, t.getMessage(), t);
119            }
120    
121            public void warn(Object msg, Throwable t) {
122                    _log.log(Level.WARNING, msg.toString(), t);
123            }
124    
125            private Logger _log;
126    
127    }