All Downloads are FREE. Search and download functionalities are using the official Maven repository.

uk.org.retep.xmpp.muc.beans.BasicMucLogger Maven / Gradle / Ivy

There is a newer version: 10.6
Show newest version
/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package uk.org.retep.xmpp.muc.beans;

import uk.org.retep.logging.LogSupport;
import uk.org.retep.xmpp.message.Body;
import uk.org.retep.xmpp.message.Message;
import uk.org.retep.xmpp.muc.MucLogger;
import uk.org.retep.xmpp.muc.MucRoom;
import uk.org.retep.xmpp.util.MessageFactory;

/**
 * A simple {@link MucLogger} implementation which just records body content
 * 
 * @author peter
 */
public class BasicMucLogger
        extends LogSupport
        implements MucLogger
{

    /**
     * {@inheritDoc}
     */
    @Override
    public void logMessage( final MucRoom room, final Message message )
    {
        if( getLog().isInfoEnabled() )
        {
            final Body body = MessageFactory.getBody( message );
            if( body == null )
            {
                getLog().info( "%s %s NO_BODY", message.getFrom(),
                               room.getJid() );
            }
            else
            {
                getLog().info( "%s %s %s",
                               message.getFrom(),
                               room.getJid(),
                               body.getValue() );
            }

        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy