Class LogService

Object
LogService

public class LogService extends Object
Author:
maartenl
  • Constructor Details

    • LogService

      public LogService()
  • Method Details

    • getEntityManager

      protected EntityManager getEntityManager()
      Returns the entity manager of JPA. This is defined in build/web/WEB-INF/classes/META-INF/persistence.xml.
      Returns:
      EntityManager
    • getLogs

      @Nonnull public List<Log> getLogs(@Nullable String name, @Nullable LocalDate from, @Nullable LocalDate to)
      Parameters:
      name - the name of the player
      from - all 1000 messages after and including this date.
      to - all 1000 messages up to and including this date.
      Returns:
      list of logs
    • writeDeputyLog

      public void writeDeputyLog(Admin admin, String message, String addendum)
      write a deputy log message to the database.
      Parameters:
      admin - the deputy which has caused this log message.
      message - the message to be written in the log, may not be larger than 255 characters or it will be truncated, and a second message will be logged mentioning this.
      addendum - the rest of the message, can be large. Used for storing specifics regarding the logmessage.
    • writeDeputyLog

      public void writeDeputyLog(Admin admin, String message)
      write a log message to the database. A simple general message.ø
      Parameters:
      admin - the deputy which has caused this log message.
      message - the message to be written in the log, may not be larger than 255 characters or it will be truncated, and a second message will be logged mentioning this.
    • writeLog

      public void writeLog(String message, String addendum)
      write a log message to the database. A simple general message.ø
      Parameters:
      message - the message to be written in the log, may not be larger than 255 characters or it will be truncated, and a second message will be logged mentioning this.
      addendum - the rest of the message, can be large. Used for storing specifics regarding the logmessage.
    • writeLog

      public void writeLog(String message)
      write a log message to the database. A simple general message.ø
      Parameters:
      message - the message to be written in the log, may not be larger than 255 characters or it will be truncated, and a second message will be logged mentioning this.
    • writeLog

      public void writeLog(Person person, String message)
      write a log message to the database. This log facility is primarily used to keep a record of what kind of important mutations are done or attempted by both characters as well as administrators. Some examples:
      • an item is picked up off the floor by a character
      • an item is eaten
      • an administrator creates a new item/room/character
      Parameters:
      person - the person to be inscribed in the log table. May be null.
      message - the message to be written in the log, may not be larger than 255 characters or it will be truncated, and a second message will be logged mentioning this.
    • writeLog

      public void writeLog(Person person, String message, String addendum)
      write a log message to the database. This log facility is primarily used to keep a record of what kind of important mutations are done or attempted by both characters as well as administrators. Some examples:
      • an item is picked up off the floor by a character
      • an item is eaten
      • an administrator creates a new item/room/character
      Parameters:
      person - the person to be inscribed in the log table. May be null.
      message - the message to be written in the log, may not be larger than 255 characters or it will be truncated, and a second message will be logged mentioning this.
      addendum - the rest of the message, can be large. Used for storing specifics regarding the logmessage.
    • writeLogException

      public void writeLogException(Person person, Throwable throwable)
      write a log message of an exception to the database.
      Parameters:
      person - the person to be inscribed in the log table. May be null.
      throwable - the exception or error to be written to the log table.
    • writeLogException

      public void writeLogException(Person person, String message, Throwable throwable)
      write a log message of an exception to the database.
      Parameters:
      person - the person to be inscribed in the log table. May be null.
      throwable - the exception or error to be written to the log table.
    • writeLogException

      public void writeLogException(String message, Throwable throwable)
      write a log message of an exception to the database.
      Parameters:
      throwable - the exception or error to be written to the log table.
    • writeLogException

      public void writeLogException(Throwable throwable)
      write a log message of an exception to the database.
      Parameters:
      throwable - the exception or error to be written to the log table.
    • writeCommandLog

      public void writeCommandLog(Person person, String command)
      write a command to the database. This log facility is primarily used to keep a chatrecord.
      Parameters:
      person - the person to be inscribed in the log table. May be null.
      command - the command that is to be executed written in the log, may not be larger than 255 characters.