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