Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## things.thinger.kernel.basic
Class KernelBasic_WriterLogger

    java.lang.Object
      things.thinger.kernel.basic.KernelBasic_WriterLogger

All Implemented Interfaces:
  Debuggable, StringPoster, PushDrain, Logger, ResourceInterface

    public class KernelBasic_WriterLogger

extends java.lang.Object
implements Logger, PushDrain, ResourceInterface

Implements a Writer based logger. It will implement PushDrain in case the Kernel wants to use it as a conduit terminus.
The default Logger.TYPE will be BROADCAST. The default debugging state is off.

Changing the LEVEL through Logger or Debuggable interface will remember the LEVEL before transition. Calling debuggingOff() will restore whatever the remember LEVEL is. So, it is possible it could return it to an unintended state, depending on how you use it.

Version:
  1.0

  Version History

      EPG - Initial - 10 FEB 06

Author:
  Erich P. Gatejen

Nested Class Summary

Nested classes/interfaces inherited from interface things.thinger.io.Logger
`Logger.LEVEL, Logger.TYPE`

Nested classes/interfaces inherited from interface things.thinger.kernel.ResourceInterface
`ResourceInterface.State`

Field Summary

Fields inherited from interface things.thinger.kernel.ResourceInterface
`NULL_ID`

Constructor Summary
`KernelBasic_WriterLogger()`

Method Summary
`void` | `debug(java.lang.String msg)` Log a trivial debug entry.
`void` | `debug(java.lang.String msg, int numeric)` Log a trivial error entry with a numeric.
`void` | `debug(java.lang.String msg, int numeric, java.util.Collection<NVImmutable> attributes)` Log a complex debug entry with numerics and attributes.
`void` | `debug(java.lang.String msg, int numeric, NVImmutable... attributes)` Log a complex debug entry with numerics and attributes.
`void` | `debug(java.lang.String msg, int numeric, java.lang.String... attributes)` Log a complex debug entry with numerics and attributes.
`void` | `debuggingOff()` Turn debugging off.
`void` | `debuggingOn()` Turn debugging on.
`boolean` | `debuggingState()` Get the current debugging state.
`void` | `disposeResource()` This is how the system tells a resource he is about to be destroyed.
`void` | `error(java.lang.String msg)` Log a trivial error entry.
`void` | `error(java.lang.String msg, int numeric)` Log a trivial error entry with a numeric.
`void` | `error(java.lang.String msg, int numeric, java.util.Collection<NVImmutable> attributes)` Log a complex error entry with numerics and attributes.
`void` | `error(java.lang.String msg, int numeric, NVImmutable... attributes)` Log a complex error entry with numerics and attributes.
`void` | `error(java.lang.String msg, int numeric, java.lang.String... attributes)` Log a complex error entry with numerics and attributes.
`void` | `exception(java.lang.Throwable tr)` Log an exception.
`void` | `flush()` Tell the underlying system to flush any entries.
`WhoAmI` | `getId()` Get ID of the resource.
`Logger.LEVEL` | `getLevel()` This will get the level of entries that will pass.
`ResourceInterface.State` | `getState()` Get the current state.
`void` | `info(java.lang.String msg)` Log a trivial information entry.
`void` | `info(java.lang.String msg, int numeric)` Log a trivial information entry with a numeric.
`void` | `info(java.lang.String msg, int numeric, java.util.Collection<NVImmutable> attributes)` Log a complex information entry with numerics and attributes.
`void` | `info(java.lang.String msg, int numeric, NVImmutable... attributes)` Log a complex information entry with numerics and attributes.
`void` | `info(java.lang.String msg, int numeric, java.lang.String... attributes)` Log a complex info entry with numerics and attributes.
`void` | `init(ConduitID yourId)` Initialize the PushDrain.
`void` | `init(Logger.TYPE loggerType)` Initialized the logger.
`void` | `init(java.io.PrintWriter out, WhoAmI ownerId, Logger.LEVEL level)` Initialize the LoggerWriter with a Writer and a prefix ID.
`void` | `initResource(WhoAmI id)` Initialize the resource.
`boolean` | `lock()` Lock an object.
`void` | `post(Entry e)` Post an Entry.
`void` | `post(java.lang.String message)` Post as a message.
`void` | `postit(java.lang.String message)` Post as a message.
`Receipt` | `postListener(Data n)` Listen for a post.
`void` | `setLevel(Logger.LEVEL newLevel)` This will set the level of entries that will pass.
`void` | `setPostLevel(Logger.LEVEL newLevel)` This will set the default level of StringPoster posted entries.
`void` | `shout(java.lang.String msg, int numeric, Logger.LEVEL theLevel)` Shout a log entry with numerics.
`void` | `shout(java.lang.String msg, int numeric, Logger.LEVEL theLevel, java.util.Collection<NVImmutable> attributes)` Shout a log entry with numerics and attributes.
`void` | `shout(java.lang.String msg, int numeric, Logger.LEVEL theLevel, NVImmutable... attributes)` Shout a log entry with numerics and attributes.
`void` | `shout(java.lang.String msg, int numeric, Logger.LEVEL theLevel, java.lang.String... attributes)` Shout a log entry with numerics and attributes.
`void` | `shout(java.lang.String msg, Logger.LEVEL theLevel)` Shout a log entry.
`void` | `unlock()` This call is only meaningful if the thread holds the lock.
`void` | `warning(java.lang.String msg)` Log a trivial warning entry.
`void` | `warning(java.lang.String msg, int numeric)` Log a trivial warning entry with a numeric.
`void` | `warning(java.lang.String msg, int numeric, java.util.Collection<NVImmutable> attributes)` Log a complex warning entry with numerics and attributes.
`void` | `warning(java.lang.String msg, int numeric, NVImmutable... attributes)` Log a complex warning entry with numerics and attributes.
`void` | `warning(java.lang.String msg, int numeric, java.lang.String... attributes)` Log a complex warning entry with numerics and attributes.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### KernelBasic_WriterLogger

    public KernelBasic_WriterLogger()

Method Detail

### init

    public void init(java.io.PrintWriter out,
                     WhoAmI ownerId,
                     Logger.LEVEL level)
              throws SystemException

  Initialize the LoggerWriter with a Writer and a prefix ID. The prefix ID will be overridden by a conduit ID, if a PushDrain tries to initialize this.
  You cannot call this more than once.

  Parameters:
    `out` - A writer. The implementation doesn't care what kind. If the Logger type is set as reliable, then every write will be flushed.
    `ownerId` - Owner id. The TAG will be used only.
    `level` - The logging level. Note that the debug methods will override any value passed here.
  Throws:
    `SystemException`

### post

    public void post(java.lang.String message)
              throws ThingsException

  Post as a message.

  Specified by:
    `post` in interface `StringPoster`
  Parameters:
    `message` - String to post
  Throws:
    `ThingsException`

### postit

    public void postit(java.lang.String message)

  Post as a message. Best effort. Ignore errors.

  Specified by:
    `postit` in interface `StringPoster`
  Parameters:
    `message` - String to post

### setPostLevel

    public void setPostLevel(Logger.LEVEL newLevel)

  This will set the default level of StringPoster posted entries. The default starts as DATA. That means, all posted strings will be treated as DATA level.

  Specified by:
    `setPostLevel` in interface `Logger`
  Parameters:
    `newLevel` - the new default level.
  Throws:
    `SystemException`

### setLevel

    public void setLevel(Logger.LEVEL newLevel)

  This will set the level of entries that will pass. It starts at whatever the implementation sets during construction.

  Specified by:
    `setLevel` in interface `Logger`
  Parameters:
    `newLevel` - the new level.

### getLevel

    public Logger.LEVEL getLevel()

  This will get the level of entries that will pass. It starts at whatever the implementation sets during construction.

  Specified by:
    `getLevel` in interface `Logger`
  Returns:
    the level.

### init

    public void init(ConduitID yourId)
              throws SystemException

  Initialize the PushDrain. This will be called by it's controller. An subsequent calls may result in a PANIC SystemException. Don't do it!

  Specified by:
    `init` in interface `PushDrain`
  Parameters:
    `yourId` - The ConduitID for this PushDrain.
  Throws:
    `SystemException`
  See Also:
    `ConduitID`

### postListener

    public Receipt postListener(Data n)
                         throws SystemException

  Listen for a post. Consumers should implement this.

  Specified by:
    `postListener` in interface `PushDrain`
  Parameters:
    `n` - The data to post.
  Returns:
    a receipt
  Throws:
    `SystemException`

### init

    public void init(Logger.TYPE loggerType)
              throws SystemException

  Initialized the logger. This will be done by the constructing system, typically the System or Kernel, so most users should not call this directly.

  Specified by:
    `init` in interface `Logger`
  Parameters:
    `loggerType` - The type of logger this should be. This is more a request than a demand.
  Throws:
    `SystemException`

### debuggingOn

    public void debuggingOn()

  Turn debugging on. Logs with debug level priority will be passed.

  Specified by:
    `debuggingOn` in interface `Debuggable`

### debuggingOff

    public void debuggingOff()

  Turn debugging off. Logs with debug level priority will not be passed.

  Specified by:
    `debuggingOff` in interface `Debuggable`

### debuggingState

    public boolean debuggingState()

  Get the current debugging state.

  Specified by:
    `debuggingState` in interface `Debuggable`
  Returns:
    debugging state

### flush

    public void flush()

  Tell the underlying system to flush any entries.

  Specified by:
    `flush` in interface `StringPoster`
  Specified by:
    `flush` in interface `Logger`

### post

    public void post(Entry e)
              throws SystemException

  Post an Entry.

  Specified by:
    `post` in interface `Logger`
  Parameters:
    `e` - The entry.
  Throws:
    `SystemException`
  See Also:
    `Entry`

### exception

    public void exception(java.lang.Throwable tr)
                   throws SystemException

  Log an exception. The implementation should try to deal with the ThingsException features.

  Specified by:
    `exception` in interface `Logger`
  Parameters:
    `tr` - The Exception.
  Throws:
    `SystemException`

### error

    public void error(java.lang.String msg)
               throws SystemException

  Log a trivial error entry.

  Specified by:
    `error` in interface `Logger`
  Parameters:
    `msg` - The text message.
  Throws:
    `SystemException`

### error

    public void error(java.lang.String msg,
                      int numeric)
               throws SystemException

  Log a trivial error entry with a numeric.

  Specified by:
    `error` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
  Throws:
    `SystemException`

### error

    public void error(java.lang.String msg,
                      int numeric,
                      NVImmutable... attributes)
               throws SystemException

  Log a complex error entry with numerics and attributes.

  Specified by:
    `error` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Sequence of NVs representing attributes.
  Throws:
    `SystemException`
  See Also:
    `NVImmutable`

### error

    public void error(java.lang.String msg,
                      int numeric,
                      java.util.Collection<NVImmutable> attributes)
               throws SystemException

  Log a complex error entry with numerics and attributes.

  Specified by:
    `error` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Sequence of NVs representing attributes.
  Throws:
    `SystemException`
  See Also:
    `NVImmutable`

### error

    public void error(java.lang.String msg,
                      int numeric,
                      java.lang.String... attributes)
               throws SystemException

  Log a complex error entry with numerics and attributes.

  Specified by:
    `error` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Name/value pairs for attributes. Must be an even number of Strings.
  Throws:
    `SystemException`
  See Also:
    `NV`

### warning

    public void warning(java.lang.String msg)
                 throws SystemException

  Log a trivial warning entry.

  Specified by:
    `warning` in interface `Logger`
  Parameters:
    `msg` - The text message.
  Throws:
    `SystemException`

### warning

    public void warning(java.lang.String msg,
                        int numeric)
                 throws SystemException

  Log a trivial warning entry with a numeric.

  Specified by:
    `warning` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
  Throws:
    `SystemException`

### warning

    public void warning(java.lang.String msg,
                        int numeric,
                        NVImmutable... attributes)
                 throws SystemException

  Log a complex warning entry with numerics and attributes.

  Specified by:
    `warning` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Sequence of NVs representing attributes.
  Throws:
    `SystemException`
  See Also:
    `NVImmutable`

### warning

    public void warning(java.lang.String msg,
                        int numeric,
                        java.util.Collection<NVImmutable> attributes)
                 throws SystemException

  Log a complex warning entry with numerics and attributes.

  Specified by:
    `warning` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Sequence of NVs representing attributes.
  Throws:
    `SystemException`
  See Also:
    `NVImmutable`

### warning

    public void warning(java.lang.String msg,
                        int numeric,
                        java.lang.String... attributes)
                 throws SystemException

  Log a complex warning entry with numerics and attributes.

  Specified by:
    `warning` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Name/value pairs for attributes. Must be an even number of Strings.
  Throws:
    `SystemException`

### info

    public void info(java.lang.String msg)
              throws SystemException

  Log a trivial information entry.

  Specified by:
    `info` in interface `Logger`
  Parameters:
    `msg` - The text message.
  Throws:
    `SystemException`

### info

    public void info(java.lang.String msg,
                     int numeric)
              throws SystemException

  Log a trivial information entry with a numeric.

  Specified by:
    `info` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
  Throws:
    `SystemException`

### info

    public void info(java.lang.String msg,
                     int numeric,
                     NVImmutable... attributes)
              throws SystemException

  Log a complex information entry with numerics and attributes.

  Specified by:
    `info` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Sequence of NVs representing attributes.
  Throws:
    `SystemException`
  See Also:
    `NVImmutable`

### info

    public void info(java.lang.String msg,
                     int numeric,
                     java.util.Collection<NVImmutable> attributes)
              throws SystemException

  Log a complex information entry with numerics and attributes.

  Specified by:
    `info` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Sequence of NVs representing attributes.
  Throws:
    `SystemException`
  See Also:
    `NVImmutable`

### info

    public void info(java.lang.String msg,
                     int numeric,
                     java.lang.String... attributes)
              throws SystemException

  Log a complex info entry with numerics and attributes.

  Specified by:
    `info` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Name/value pairs for attributes. Must be an even number of Strings.
  Throws:
    `SystemException`

### debug

    public void debug(java.lang.String msg)
               throws SystemException

  Log a trivial debug entry.

  Specified by:
    `debug` in interface `Logger`
  Parameters:
    `msg` - The text message.
  Throws:
    `SystemException`

### debug

    public void debug(java.lang.String msg,
                      int numeric)
               throws SystemException

  Log a trivial error entry with a numeric.

  Specified by:
    `debug` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
  Throws:
    `SystemException`

### debug

    public void debug(java.lang.String msg,
                      int numeric,
                      NVImmutable... attributes)
               throws SystemException

  Log a complex debug entry with numerics and attributes.

  Specified by:
    `debug` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Sequence of NVs representing attributes.
  Throws:
    `SystemException`
  See Also:
    `NVImmutable`

### debug

    public void debug(java.lang.String msg,
                      int numeric,
                      java.util.Collection<NVImmutable> attributes)
               throws SystemException

  Log a complex debug entry with numerics and attributes.

  Specified by:
    `debug` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Sequence of NVs representing attributes.
  Throws:
    `SystemException`
  See Also:
    `NVImmutable`

### debug

    public void debug(java.lang.String msg,
                      int numeric,
                      java.lang.String... attributes)
               throws SystemException

  Log a complex debug entry with numerics and attributes.

  Specified by:
    `debug` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `attributes` - Name/value pairs for attributes. Must be an even number of Strings.
  Throws:
    `SystemException`
  See Also:
    `NV`

### shout

    public void shout(java.lang.String msg,
                      Logger.LEVEL theLevel)

  Shout a log entry. This is best effort and it will never return an exception.

  Specified by:
    `shout` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `theLevel` - The level of the message.

### shout

    public void shout(java.lang.String msg,
                      int numeric,
                      Logger.LEVEL theLevel)

  Shout a log entry with numerics. This is best effort and it will never return an exception.

  Specified by:
    `shout` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `theLevel` - The level of the message.
  See Also:
    `NV`

### shout

    public void shout(java.lang.String msg,
                      int numeric,
                      Logger.LEVEL theLevel,
                      NVImmutable... attributes)

  Shout a log entry with numerics and attributes. This is best effort and it will never return an exception.

  Specified by:
    `shout` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `theLevel` - The level of the message.
    `attributes` - Sequence of NVs representing attributes.
  See Also:
    `NVImmutable`

### shout

    public void shout(java.lang.String msg,
                      int numeric,
                      Logger.LEVEL theLevel,
                      java.util.Collection<NVImmutable> attributes)

  Shout a log entry with numerics and attributes. This is best effort and it will never return an exception.

  Specified by:
    `shout` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `theLevel` - The level of the message.
    `attributes` - Sequence of NVs representing attributes.
  See Also:
    `NVImmutable`

### shout

    public void shout(java.lang.String msg,
                      int numeric,
                      Logger.LEVEL theLevel,
                      java.lang.String... attributes)

  Shout a log entry with numerics and attributes. This is best effort and it will never return an exception.

  Specified by:
    `shout` in interface `Logger`
  Parameters:
    `msg` - The text message.
    `numeric` - The numeric.
    `theLevel` - The level of the message.
    `attributes` - Name/value pairs for attributes. Must be an even number of Strings.
  See Also:
    `NV`

### initResource

    public void initResource(WhoAmI id)
                      throws SystemException

  Initialize the resource. This must be called before use. It should be called by the Kernel.

  Specified by:
    `initResource` in interface `ResourceInterface`
  Parameters:
    `id` - The id of the resource.
  Throws:
    `SystemException`
  See Also:
    `WhoAmI`

### disposeResource

    public void disposeResource()
                         throws SystemException

  This is how the system tells a resource he is about to be destroyed. Typically, the system will allow the resource some time to clean up, however the implementation should assume that the system can become impatient at any moment and summerily execute it.
  This may be called asynchronously by the system at any time and by any thread, so a smart system would manage conflicts and thread issues.

  Specified by:
    `disposeResource` in interface `ResourceInterface`
  Throws:
    `SystemException`

### lock

    public boolean lock()
                 throws SystemException

  Lock an object. This is blocking. Locks will prevent any other thread from accessing the resource. However, the resource may not allow locks, and it will return false if the lock was disallowed.

  Specified by:
    `lock` in interface `ResourceInterface`
  Returns:
    true if the lock was completed, false if locks are not allowed.
  Throws:
    `SystemException`

### unlock

    public void unlock()
                throws SystemException

  This call is only meaningful if the thread holds the lock. The resource could choose to ignore it, but locking is not supported.
  If locks are supported and the thread does not own the lock, the resource may throw an exception.

  Specified by:
    `unlock` in interface `ResourceInterface`
  Throws:
    `SystemException`

### getId

    public WhoAmI getId()
                 throws SystemException

  Get ID of the resource. If the resource has not been initResource(), this should throw an exception.

  Specified by:
    `getId` in interface `ResourceInterface`
  Returns:
    WhoAmI
  Throws:
    `SystemException`
  See Also:
    `WhoAmI`

### getState

    public ResourceInterface.State getState()
                                     throws SystemException

  Get the current state.

  Specified by:
    `getState` in interface `ResourceInterface`
  Returns:
    State
  Throws:
    `SystemException`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Things.