Class LogContext


  • public class LogContext
    extends Object
    Contains log information about a service to be invoked.
    A service could be: a web-rpc service method, a custom web service, an external redirect callback (custom operation) or an inbound sms.
    The information contained in this context will be logged though the LoggingHandler's implementation.
    Note: if any of ServiceLogParams or LogConfiguration are null it means a log entry must not be generated, all methods take this into account being safe to call any of them even in that case. Example: if ServiceLogParams is null you can call the setError(Throwable) method directly (it will be a noop).
    • Method Detail

      • logService

        public void logService()
        Writes a log entry through the LoggingHandler.
        Noop if logParams is null.
      • setError

        public void setError​(Throwable error)
        Sets the error thrown by the service's execution.
        Noop if logParams or logConfiguration are null.
      • setResult

        public LogContext setResult​(Pair<Object,​com.fasterxml.jackson.databind.JsonNode> resultPair)
        Sets the result of a service's execution and returns the same instance.
        Noop if logParams or logConfiguration are null.
      • setSkipSuccess

        public void setSkipSuccess​(boolean skipSuccess)
      • setTimeTaken

        public LogContext setTimeTaken​(long timeTaken)
        Sets the time taken by the execution and returns the same instance.
        Noop if logParams or logConfiguration are null.
      • setWrite

        public LogContext setWrite​(boolean isWrite)
        Sets this invocation as having a write to the database and returns the same instance.