net.sf.ircappender
Class IrcHandler

java.lang.Object
  extended by java.util.logging.Handler
      extended by net.sf.ircappender.IrcHandler

public class IrcHandler
extends java.util.logging.Handler

appends log-events to an irc channel.


Constructor Summary
IrcHandler()
          Initializes the system after the options are set
 
Method Summary
 void close()
          Shuts down the appender.
 void flush()
           
 int getBuffersize()
          Returns the configured buffersize
 java.lang.String getBuffertype()
          gets the name of the buffer strategy
 java.lang.String getChannel()
          Returns the configured channel
 java.lang.String getHost()
          Returns the configured host
 long getMessageDelay()
          gets the delay between multiple messages
 java.lang.String getNickname()
          gets the IRC nickname of the bot
 java.lang.String getPassword()
          gets the IRC password
 int getPort()
          Returns the configured irc server port
 java.lang.String getUsername()
          gets the IRC username
 boolean isDebug()
          is debugging enabled
 boolean isSsl()
          Is SSL used to secure the connection to the IRC server?
 void publish(java.util.logging.LogRecord logRecord)
          Recieves a LoggingEvent for handling.
 void setBuffersize(int buffersize)
          Sets the buffersize.
 void setBuffertype(java.lang.String buffertype)
          Sets the buffer strategy.
 void setChannel(java.lang.String channel)
          Sets the channel.
 void setDebug(boolean debug)
          enables or disables debugging messages
 void setHost(java.lang.String host)
          Sets the host.
 void setMessageDelay(long messageDelay)
          Set the delay between messages.
 void setNickname(java.lang.String nickname)
          Sets the nickname.
 void setPassword(java.lang.String password)
          Sets the password.
 void setPort(int port)
          Sets the irc server port
 void setSsl(boolean ssl)
          Enables or disables the use of SSL for the IRC connection
 void setUsername(java.lang.String username)
          Sets the username.
 
Methods inherited from class java.util.logging.Handler
getEncoding, getErrorManager, getFilter, getFormatter, getLevel, isLoggable, setEncoding, setErrorManager, setFilter, setFormatter, setLevel
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IrcHandler

public IrcHandler()
Initializes the system after the options are set

Method Detail

close

public void close()
Shuts down the appender. Handles telling the bot to close and waiting for the bot to cleanly close its thread before continuing.

Specified by:
close in class java.util.logging.Handler

flush

public void flush()
Specified by:
flush in class java.util.logging.Handler

getBuffersize

public int getBuffersize()
Returns the configured buffersize

Returns:
double

getBuffertype

public java.lang.String getBuffertype()
gets the name of the buffer strategy

Returns:
String

getChannel

public java.lang.String getChannel()
Returns the configured channel

Returns:
String

getHost

public java.lang.String getHost()
Returns the configured host

Returns:
String

getMessageDelay

public long getMessageDelay()
gets the delay between multiple messages

Returns:
long delay in milliseconds

getNickname

public java.lang.String getNickname()
gets the IRC nickname of the bot

Returns:
nickname

getPassword

public java.lang.String getPassword()
gets the IRC password

Returns:
password

getPort

public int getPort()
Returns the configured irc server port

Returns:
int

getUsername

public java.lang.String getUsername()
gets the IRC username

Returns:
username

isDebug

public boolean isDebug()
is debugging enabled

Returns:
true, if debugging is enabled, false otherwise

isSsl

public boolean isSsl()
Is SSL used to secure the connection to the IRC server?

Returns:
ssl ussage

publish

public void publish(java.util.logging.LogRecord logRecord)
Recieves a LoggingEvent for handling. Ignores if the appender is in the process of closing down.

Specified by:
publish in class java.util.logging.Handler
Parameters:
logRecord - logging event

setBuffersize

public void setBuffersize(int buffersize)
Sets the buffersize.

Parameters:
buffersize - The buffersize to set

setBuffertype

public void setBuffertype(java.lang.String buffertype)
Sets the buffer strategy.

Parameters:
buffertype - The buffertype to set

setChannel

public void setChannel(java.lang.String channel)
Sets the channel.

Parameters:
channel - The channel to set

setDebug

public void setDebug(boolean debug)
enables or disables debugging messages

Parameters:
debug - should debug message be written to stdout?

setHost

public void setHost(java.lang.String host)
Sets the host.

Parameters:
host - The host to set

setMessageDelay

public void setMessageDelay(long messageDelay)
Set the delay between messages. Note that some IRC servers have a rate limit which may be stricter.

Parameters:
messageDelay - in milliseconds

setNickname

public void setNickname(java.lang.String nickname)
Sets the nickname.

Parameters:
nickname - The nickname to set

setPassword

public void setPassword(java.lang.String password)
Sets the password.

Parameters:
password - The password to set

setPort

public void setPort(int port)
Sets the irc server port

Parameters:
port - port

setSsl

public void setSsl(boolean ssl)
Enables or disables the use of SSL for the IRC connection

Parameters:
ssl - true to enable SSL security

setUsername

public void setUsername(java.lang.String username)
Sets the username.

Parameters:
username - The username to set