001/**
002 *
003 * Copyright (c) 2014, the Railo Company Ltd. All rights reserved.
004 *
005 * This library is free software; you can redistribute it and/or
006 * modify it under the terms of the GNU Lesser General Public
007 * License as published by the Free Software Foundation; either 
008 * version 2.1 of the License, or (at your option) any later version.
009 * 
010 * This library is distributed in the hope that it will be useful,
011 * but WITHOUT ANY WARRANTY; without even the implied warranty of
012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
013 * Lesser General Public License for more details.
014 * 
015 * You should have received a copy of the GNU Lesser General Public 
016 * License along with this library.  If not, see <http://www.gnu.org/licenses/>.
017 * 
018 **/
019package lucee.commons.io.log;
020
021import lucee.runtime.exp.DeprecatedException;
022
023public class LegacyLogger implements LogAndSource {
024
025        private final Log logger;
026
027        public LegacyLogger(Log logger) {
028                this.logger=logger;
029        }
030
031        @Override
032        public void log(int level, String application, String message) {
033                logger.log(level, application, message);
034        }
035
036        @Override
037        public void info(String application, String message) {
038                log(Log.LEVEL_INFO,application,message);
039        }
040
041        @Override
042        public void debug(String application, String message) {
043                log(Log.LEVEL_DEBUG,application,message);
044        }
045
046        @Override
047        public void warn(String application, String message) {
048                log(Log.LEVEL_WARN,application,message);
049        }
050
051        @Override
052        public void error(String application, String message) {
053                log(Log.LEVEL_ERROR,application,message);
054        }
055
056        @Override
057        public void fatal(String application, String message) {
058                log(Log.LEVEL_FATAL,application,message);
059        }
060
061        @Override
062        public int getLogLevel() {
063                return logger.getLogLevel();
064        }
065
066        @Override
067        public void setLogLevel(int level) {
068                logger.setLogLevel(level);
069        }
070
071        @Override
072        public Log getLog() {
073                return logger;
074        }
075
076        @Override
077        public String getSource() {
078                throw new RuntimeException(new DeprecatedException("this method is no longer supported"));
079        }
080
081}