001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one or more
003     * contributor license agreements.  See the NOTICE file distributed with
004     * this work for additional information regarding copyright ownership.
005     * The ASF licenses this file to You under the Apache License, Version 2.0
006     * (the "License"); you may not use this file except in compliance with
007     * the License.  You may obtain a copy of the License at
008     *
009     *      http://www.apache.org/licenses/LICENSE-2.0
010     *
011     * Unless required by applicable law or agreed to in writing, software
012     * distributed under the License is distributed on an "AS IS" BASIS,
013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     * See the License for the specific language governing permissions and
015     * limitations under the License.
016     */
017    package org.apache.camel.component.irc;
018    
019    import org.apache.commons.logging.Log;
020    import org.schwering.irc.lib.IRCEventAdapter;
021    import org.schwering.irc.lib.IRCModeParser;
022    import org.schwering.irc.lib.IRCUser;
023    
024    /**
025     * A helper class which logs errors
026     *
027     * @version $Revision: 630591 $
028     */
029    public class IrcErrorLogger extends IRCEventAdapter {
030        private Log log;
031    
032        public IrcErrorLogger(Log log) {
033            this.log = log;
034        }
035    
036        @Override
037        public void onRegistered() {
038            super.onRegistered();
039            log.info("onRegistered");
040        }
041    
042        @Override
043        public void onDisconnected() {
044            super.onDisconnected();
045            log.info("onDisconnected");
046        }
047    
048        @Override
049        public void onMode(String string, IRCUser ircUser, IRCModeParser ircModeParser) {
050            super.onMode(string, ircUser, ircModeParser);
051            log.info("onMode.string = " + string);
052            log.info("onMode.ircUser = " + ircUser);
053            log.info("onMode.ircModeParser = " + ircModeParser);
054        }
055    
056        @Override
057        public void onMode(IRCUser ircUser, String string, String string1) {
058            super.onMode(ircUser, string, string1);
059            log.info("onMode.ircUser = " + ircUser);
060            log.info("onMode.string = " + string);
061            log.info("onMode.string1 = " + string1);
062        }
063    
064        @Override
065        public void onPing(String string) {
066            super.onPing(string);
067            log.info("onPing.string = " + string);
068        }
069    
070        @Override
071        public void onError(String string) {
072            log.info("onError.string = " + string);
073        }
074    
075        @Override
076        public void onError(int i, String string) {
077            super.onError(i, string);
078            log.error("onError.i = " + i);
079            log.error("onError.string = " + string);
080        }
081    
082        @Override
083        public void unknown(String string, String string1, String string2, String string3) {
084            super.unknown(string, string1, string2, string3);
085            log.error("unknown.string = " + string);
086            log.error("unknown.string1 = " + string1);
087            log.error("unknown.string2 = " + string2);
088            log.error("unknown.string3 = " + string3);
089        }
090    }