[766] | 1 | /* |
---|
| 2 | Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. |
---|
| 3 | |
---|
| 4 | |
---|
| 5 | The MySQL Connector/J is licensed under the terms of the GPLv2 |
---|
| 6 | <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most MySQL Connectors. |
---|
| 7 | There are special exceptions to the terms and conditions of the GPLv2 as it is applied to |
---|
| 8 | this software, see the FLOSS License Exception |
---|
| 9 | <http://www.mysql.com/about/legal/licensing/foss-exception.html>. |
---|
| 10 | |
---|
| 11 | This program is free software; you can redistribute it and/or modify it under the terms |
---|
| 12 | of the GNU General Public License as published by the Free Software Foundation; version 2 |
---|
| 13 | of the License. |
---|
| 14 | |
---|
| 15 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; |
---|
| 16 | without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
---|
| 17 | See the GNU General Public License for more details. |
---|
| 18 | |
---|
| 19 | You should have received a copy of the GNU General Public License along with this |
---|
| 20 | program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth |
---|
| 21 | Floor, Boston, MA 02110-1301 USA |
---|
| 22 | |
---|
| 23 | |
---|
| 24 | |
---|
| 25 | */ |
---|
| 26 | |
---|
| 27 | package com.mysql.jdbc.log; |
---|
| 28 | |
---|
| 29 | import org.slf4j.Logger; |
---|
| 30 | import org.slf4j.LoggerFactory; |
---|
| 31 | |
---|
| 32 | public class Slf4JLogger implements Log { |
---|
| 33 | private Logger log; |
---|
| 34 | |
---|
| 35 | public Slf4JLogger(String name) { |
---|
| 36 | log = LoggerFactory.getLogger(name); |
---|
| 37 | } |
---|
| 38 | |
---|
| 39 | public boolean isDebugEnabled() { |
---|
| 40 | return log.isDebugEnabled(); |
---|
| 41 | } |
---|
| 42 | |
---|
| 43 | public boolean isErrorEnabled() { |
---|
| 44 | return log.isErrorEnabled(); |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | public boolean isFatalEnabled() { |
---|
| 48 | return log.isErrorEnabled(); |
---|
| 49 | } |
---|
| 50 | |
---|
| 51 | public boolean isInfoEnabled() { |
---|
| 52 | return log.isInfoEnabled(); |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | public boolean isTraceEnabled() { |
---|
| 56 | return log.isTraceEnabled(); |
---|
| 57 | } |
---|
| 58 | |
---|
| 59 | public boolean isWarnEnabled() { |
---|
| 60 | return log.isWarnEnabled(); |
---|
| 61 | } |
---|
| 62 | |
---|
| 63 | public void logDebug(Object msg) { |
---|
| 64 | log.debug(msg.toString()); |
---|
| 65 | } |
---|
| 66 | |
---|
| 67 | public void logDebug(Object msg, Throwable thrown) { |
---|
| 68 | log.debug(msg.toString(), thrown); |
---|
| 69 | } |
---|
| 70 | |
---|
| 71 | public void logError(Object msg) { |
---|
| 72 | log.error(msg.toString()); |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | public void logError(Object msg, Throwable thrown) { |
---|
| 76 | log.error(msg.toString(), thrown); |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | public void logFatal(Object msg) { |
---|
| 80 | log.error(msg.toString()); |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | public void logFatal(Object msg, Throwable thrown) { |
---|
| 84 | log.error(msg.toString(), thrown); |
---|
| 85 | } |
---|
| 86 | |
---|
| 87 | public void logInfo(Object msg) { |
---|
| 88 | log.info(msg.toString()); |
---|
| 89 | } |
---|
| 90 | |
---|
| 91 | public void logInfo(Object msg, Throwable thrown) { |
---|
| 92 | log.info(msg.toString(), thrown); |
---|
| 93 | } |
---|
| 94 | |
---|
| 95 | public void logTrace(Object msg) { |
---|
| 96 | log.trace(msg.toString()); |
---|
| 97 | } |
---|
| 98 | |
---|
| 99 | public void logTrace(Object msg, Throwable thrown) { |
---|
| 100 | log.trace(msg.toString(), thrown); |
---|
| 101 | } |
---|
| 102 | |
---|
| 103 | public void logWarn(Object msg) { |
---|
| 104 | log.warn(msg.toString()); |
---|
| 105 | } |
---|
| 106 | |
---|
| 107 | public void logWarn(Object msg, Throwable thrown) { |
---|
| 108 | log.warn(msg.toString(), thrown); |
---|
| 109 | } |
---|
| 110 | |
---|
| 111 | } |
---|