Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package de.agilecoders.wicket.logging;
  
A ClientSideLogObject represents a log message that was created on client side.

Author(s):
miha
 
 public class ClientSideLogObject {
 
     private final StringValue lvl;
     private final StringValue message;
     private final StringValue timestamp;
     private final StringValue stacktrace;
     private final int index;

    
Construct.

Parameters:
lvl the log level as org.apache.wicket.util.string.StringValue
message the message as org.apache.wicket.util.string.StringValue
timestamp the timestamp as org.apache.wicket.util.string.StringValue in UTC format.
stacktrace the client side stacktrace
index the parameter index that was used on client side to generate this log object
 
     public ClientSideLogObject(String lvlString messageString timestampString stacktraceint index) {
         this(StringValue.valueOf(lvl), StringValue.valueOf(message), StringValue.valueOf(timestamp), StringValue.valueOf(stacktrace), index);
     }

    
Construct.

Parameters:
lvl the log level as org.apache.wicket.util.string.StringValue
message the message as org.apache.wicket.util.string.StringValue
timestamp the timestamp as org.apache.wicket.util.string.StringValue in UTC format.
stacktrace the client side stacktrace as org.apache.wicket.util.string.StringValue
index the param index
 
     public ClientSideLogObject(StringValue lvlStringValue messageStringValue timestampStringValue stacktraceint index) {
         this. = lvl;
         this. = message;
         this. = timestamp;
         this. = stacktrace;
         this. = index;
     }

    

Returns:
parameter index
 
     public int index() {
         return ;
     }

    

Returns:
log level as string or "error" if not valid
 
     public String level() {
         return .toString("error");
     }

    

Returns:
stacktrace or empty string if non is set
 
     public String stacktrace() {
         return .toString("");
     }

    

Returns:
log message or default message if invalid
 
     public String message() {
         return .toString(.);
     }

    

Returns:
timestamp as string or default timestamp if invalid
 
     public String timestamp() {
     }
 
     @Override
     public String toString() {
         return String.format("[%s | %s] %s"timestamp(), level(), message());
     }
 
     @Override
     public boolean equals(Object o) {
         if (this == o) {
             return true;
         }
         if (o == null || getClass() != o.getClass()) {
             return false;
         }
 
         ClientSideLogObject logObject = (ClientSideLogObjecto;
 
        if ( != null ? !.equals(logObject.lvl) : logObject.lvl != null) {
            return false;
        }
        if ( != null ? !.equals(logObject.message) : logObject.message != null) {
            return false;
        }
        if ( != null ? !.equals(logObject.stacktrace) : logObject.stacktrace != null) {
            return false;
        }
        if ( != null ? !.equals(logObject.timestamp) : logObject.timestamp != null) {
            return false;
        }
        return true;
    }
    @Override
    public int hashCode() {
        int result =  != null ? .hashCode() : 0;
        result = 31 * result + ( != null ? .hashCode() : 0);
        result = 31 * result + ( != null ? .hashCode() : 0);
        result = 31 * result + ( != null ? .hashCode() : 0);
        return result;
    }

    

Returns:
TRUE, if all values are set
    public boolean isValid() {
        return !.isEmpty() && !.isEmpty() && !.isEmpty();
    }
New to GrepCode? Check out our FAQ X