edu.cmu.pslc.logging

## Class OliDiskLogger

- java.lang.Object
- - edu.cmu.pslc.logging.AbstractMessageLogger
  - - edu.cmu.pslc.logging.OliDiskLogger

- All Implemented Interfaces:
    MessageLogger

      public class OliDiskLogger
      extends AbstractMessageLogger

  This logger will log to a file which can then be imported to a OLI-style log database.

  The file created will be XML within XML. See the power point document for the DTD for details.

  Version:
    $Revision: 7737 $
    Last modified by: $Author: ctipper $
    Last modified on: $Date: 2012-05-30 14:17:21 -0400 (Wed, 30 May 2012) $
  Author:
    Alida Skogsholm

- - ### Field Summary

    - ### Fields inherited from class edu.cmu.pslc.logging.AbstractMessageLogger

      `CLOSE_ROOT_NODE, ENCODING_ISO_8859_1, ENCODING_UTF8, INFO_TYPE, PROD_URL, QA_URL`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OliDiskLogger(edu.cmu.oli.log.client.DiskLogger diskLogger, java.lang.String encoding)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Close the file stream.
    `static OliDiskLogger` | `create(java.lang.String fileName)` Create the message logger.
    `static OliDiskLogger` | `create(java.lang.String fileName, java.lang.String encoding)` Create the message logger.
    `static java.lang.String` | `getDefaultFilename()` Return the default filename.
    `boolean` | `log(Message message)` Logs a message to the previously given file.
    `boolean` | `log(Message message, java.util.Date timeStamp)` Logs a message with a new time stamp.
    `boolean` | `log(java.lang.String authToken, Message message)` Logs a message with an authentication token.
    `boolean` | `log(java.lang.String authToken, Message message, java.util.Date timeStamp)` Logs a message with a new time stamp, and an authentication token.
    `void` | `logSession(java.lang.String userName, java.lang.String sessionId)` Log a SessionLog record.

    - ### Methods inherited from class edu.cmu.pslc.logging.AbstractMessageLogger

      `getCloseXml, getOpenXml, getOpenXmlSchemaType`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### OliDiskLogger

          public OliDiskLogger(edu.cmu.oli.log.client.DiskLogger diskLogger,
                       java.lang.String encoding)

      Constructor.
      Parameters:
        `diskLogger` - the OLI disk logger
        `encoding` - the encoding to be indicated at the top of the XML

  - ### Method Detail

    - #### create

          public static OliDiskLogger create(java.lang.String fileName)

      Create the message logger.
      Parameters:
        `fileName` - the file name
      Returns:
        the newly created OLI disk logger

    - #### create

          public static OliDiskLogger create(java.lang.String fileName,
                             java.lang.String encoding)

      Create the message logger.
      Parameters:
        `fileName` - the file name
        `encoding` - the encoding to be indicated at the top of the XML
      Returns:
        the newly created OLI disk logger

    - #### log

          public boolean log(Message message)

      Logs a message to the previously given file.
      Parameters:
        `message` - the message to log to the file
      Returns:
        true if log succeeded, false otherwise

    - #### log

          public boolean log(java.lang.String authToken,
                    Message message)

      Logs a message with an authentication token.
      Parameters:
        `message` - the message to log
        `authToken` - the authentication token needed for authenticated logging (OLI servers)
      Returns:
        true if log succeeded, false otherwise

    - #### log

          public boolean log(Message message,
                    java.util.Date timeStamp)

      Logs a message with a new time stamp.
      Parameters:
        `message` - the message to log
        `timeStamp` - the new time stamp to use
      Returns:
        true if log succeeded, false otherwise

    - #### log

          public boolean log(java.lang.String authToken,
                    Message message,
                    java.util.Date timeStamp)

      Logs a message with a new time stamp, and an authentication token.
      Parameters:
        `message` - the message to log
        `timeStamp` - the new time stamp to use
        `authToken` - the authentication token needed for authenticated logging (OLI servers)
      Returns:
        true if log succeeded, false otherwise

    - #### logSession

          public void logSession(java.lang.String userName,
                        java.lang.String sessionId)

      Log a SessionLog record.
      Parameters:
        `userName` - the user name
        `sessionId` - the session id
      See Also:
        `SessionLog`

    - #### close

          public void close()

      Close the file stream.

    - #### getDefaultFilename

          public static java.lang.String getDefaultFilename()

      Return the default filename.
      Returns:
        String of form userID_yyyyMMddhhmmssSSS.log

Copyright (c) 2015 - Pittsburgh Science of Learning Center