Class Log

java.lang.Object
com.ns.tcpframework.logger.Log

public class Log extends Object
Represents a log entry with a specific log level, message, timestamp, and destination.
  • Constructor Details

    • Log

      public Log(Loglevel level, String message, LogDestination destination)
      Constructs a new Log instance.
      Parameters:
      level - The severity level of the log.
      message - The message content of the log.
      destination - The destination where the log will be sent.
  • Method Details

    • getLevel

      public Loglevel getLevel()
      Gets the severity level of the log.
      Returns:
      The log level.
    • getMessage

      public String getMessage()
      Gets the message content of the log.
      Returns:
      The log message.
    • getDestination

      public LogDestination getDestination()
      Gets the timestamp of when the log was created.
      Returns:
      The log timestamp in milliseconds since epoch.
    • toJson

      public org.json.JSONObject toJson()
      Converts the log entry to a JSON object for structured logging.
      Returns:
      A JSONObject representing the log entry.