From: Mathieu Baudier Date: Fri, 31 Dec 2021 10:26:03 +0000 (+0100) Subject: Remove dedicated class for log entries. X-Git-Tag: argeo-commons-2.3.5~112 X-Git-Url: https://git.argeo.org/?a=commitdiff_plain;h=9a01b6d2c296ce38cf78aa1fc1e403a0c21dc2f9;p=lgpl%2Fargeo-commons.git Remove dedicated class for log entries. --- diff --git a/org.argeo.init/src/org/argeo/init/logging/ThinLogEntry.java b/org.argeo.init/src/org/argeo/init/logging/ThinLogEntry.java deleted file mode 100644 index 51aadec32..000000000 --- a/org.argeo.init/src/org/argeo/init/logging/ThinLogEntry.java +++ /dev/null @@ -1,91 +0,0 @@ -package org.argeo.init.logging; - -import java.io.Serializable; -import java.lang.System.Logger; -import java.lang.System.Logger.Level; -import java.time.Instant; -import java.util.Objects; -import java.util.Optional; -import java.util.concurrent.atomic.AtomicLong; - -/** A log entry with equals semantics based on an incremental long sequence. */ -@Deprecated -class ThinLogEntry implements Serializable { - private static final long serialVersionUID = 5915553445193937270L; - - private final static AtomicLong next = new AtomicLong(0l); - -// private final transient Logger logger; - - private final long sequence; - private final String loggerName; - private final Instant instant; - private final Level level; - private final String message; - private final Optional throwable; - private final Optional callLocation; - - protected ThinLogEntry(Logger logger, Level level, String message, Instant instant, Throwable e, - StackTraceElement callLocation) { - // NOTE: 0 is never allocated, in order to have a concept of "null" entry - sequence = next.incrementAndGet(); -// this.logger = logger; - - this.loggerName = Objects.requireNonNull(logger).getName(); - this.instant = Objects.requireNonNull(instant); - this.level = level; - this.message = message; - this.throwable = Optional.ofNullable(e); - this.callLocation = Optional.ofNullable(callLocation); - } - - public long getSequence() { - return sequence; - } - - public Level getLevel() { - return level; - } - - public String getMessage() { - return message; - } - -// Logger getLogger() { -// return logger; -// } - - public String getLoggerName() { - return loggerName; - } - - public Instant getInstant() { - return instant; - } - - public Optional getThrowable() { - return throwable; - } - - public Optional getCallLocation() { - return callLocation; - } - - @Override - public int hashCode() { - return (int) sequence; - } - - @Override - public boolean equals(Object obj) { - if (!(obj instanceof ThinLogEntry)) - return false; - return sequence == ((ThinLogEntry) obj).sequence; - } - - @Override - public String toString() { - return message; - } - -}