com.protomatter.syslog
Interface SyslogChannelAware
- public interface SyslogChannelAware
An interface for objects that are aware of channels in
syslog.
Why is this a good thing? The idea here is that in
some baseclass for things that do logging, you implement
this interface and then everytime you pass this
into a syslog method, you magically get messages sent to
the "right" channels for the circumstances. For instance,
you might have multiple projects being hosted on the same
VM, and you don't want to have to hardcode in channel
names everywhere. You can just have the baseclass read
a configuration file or something, and everyone is happy.
Later, when you decide to have things go to other channels,
or want certain object to write to your own channels, you just
override the implementation of getSyslogChannel()
and everyone is still happy.
Method Summary |
java.lang.Object |
getSyslogChannel()
This method should return the channel that messages
coming from this object should be logged to if the
call to Syslog didn't include a channel (or the channel
specified was null). |
getSyslogChannel
public java.lang.Object getSyslogChannel()
- This method should return the channel that messages
coming from this object should be logged to if the
call to Syslog didn't include a channel (or the channel
specified was null). If an
object implementing this interface is passed into
a Syslog method as the logger (the first argument to
any of the log methods) and a channel was not specified
as part of the call to that log method, this method
will be called to determine what channel(s) the message
should be sent to. This method must return
either an instance of java.lang.String or
an array of java.lang.String if the message
should be sent to multiple channels. If there is an
error calling this method or something goes wrong,
the channel will be set to Syslog.DEFAULT_CHANNEL.