From: Robert Varga Date: Thu, 2 Mar 2023 00:20:52 +0000 (+0100) Subject: Remove io.atomix.utils.logging X-Git-Tag: v7.0.5~100 X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=commitdiff_plain;h=e52075dd3c5433ab9fd544d5e27f337ae1838b7a;p=controller.git Remove io.atomix.utils.logging Nothing in this package is needed here, remove it. JIRA: CONTROLLER-2071 Change-Id: Ie4715a34d532c905251ade6a9ca9dd01037ba1f5 Signed-off-by: Robert Varga --- diff --git a/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/ContextualLogger.java b/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/ContextualLogger.java deleted file mode 100644 index 7c11ff247a..0000000000 --- a/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/ContextualLogger.java +++ /dev/null @@ -1,392 +0,0 @@ -/* - * Copyright 2017-present Open Networking Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.atomix.utils.logging; - -import org.slf4j.Logger; -import org.slf4j.Marker; - -/** - * Contextual logger. - */ -public class ContextualLogger extends DelegatingLogger { - private static final String SEPARATOR = " - "; - private final LoggerContext context; - - public ContextualLogger(Logger delegate, LoggerContext context) { - super(delegate); - this.context = context; - } - - /** - * Returns a contextualized version of the given string. - * - * @param msg the message to contextualize - * @return the contextualized message - */ - private String contextualize(String msg) { - return context + SEPARATOR + msg; - } - - @Override - public void trace(String msg) { - if (isTraceEnabled()) { - super.trace(contextualize(msg)); - } - } - - @Override - public void trace(String format, Object arg) { - if (isTraceEnabled()) { - super.trace(contextualize(format), arg); - } - } - - @Override - public void trace(String format, Object arg1, Object arg2) { - if (isTraceEnabled()) { - super.trace(contextualize(format), arg1, arg2); - } - } - - @Override - public void trace(String format, Object... arguments) { - if (isTraceEnabled()) { - super.trace(contextualize(format), arguments); - } - } - - @Override - public void trace(String msg, Throwable t) { - if (isTraceEnabled()) { - super.trace(contextualize(msg), t); - } - } - - @Override - public void trace(Marker marker, String msg) { - if (isTraceEnabled()) { - super.trace(marker, contextualize(msg)); - } - } - - @Override - public void trace(Marker marker, String format, Object arg) { - if (isTraceEnabled()) { - super.trace(marker, contextualize(format), arg); - } - } - - @Override - public void trace(Marker marker, String format, Object arg1, Object arg2) { - if (isTraceEnabled()) { - super.trace(marker, contextualize(format), arg1, arg2); - } - } - - @Override - public void trace(Marker marker, String format, Object... argArray) { - if (isTraceEnabled()) { - super.trace(marker, contextualize(format), argArray); - } - } - - @Override - public void trace(Marker marker, String msg, Throwable t) { - if (isTraceEnabled()) { - super.trace(marker, contextualize(msg), t); - } - } - - @Override - public void debug(String msg) { - if (isDebugEnabled()) { - super.debug(contextualize(msg)); - } - } - - @Override - public void debug(String format, Object arg) { - if (isDebugEnabled()) { - super.debug(contextualize(format), arg); - } - } - - @Override - public void debug(String format, Object arg1, Object arg2) { - if (isDebugEnabled()) { - super.debug(contextualize(format), arg1, arg2); - } - } - - @Override - public void debug(String format, Object... arguments) { - if (isDebugEnabled()) { - super.debug(contextualize(format), arguments); - } - } - - @Override - public void debug(String msg, Throwable t) { - if (isDebugEnabled()) { - super.debug(contextualize(msg), t); - } - } - - @Override - public void debug(Marker marker, String msg) { - if (isDebugEnabled()) { - super.debug(marker, contextualize(msg)); - } - } - - @Override - public void debug(Marker marker, String format, Object arg) { - if (isDebugEnabled()) { - super.debug(marker, contextualize(format), arg); - } - } - - @Override - public void debug(Marker marker, String format, Object arg1, Object arg2) { - if (isDebugEnabled()) { - super.debug(marker, contextualize(format), arg1, arg2); - } - } - - @Override - public void debug(Marker marker, String format, Object... arguments) { - if (isDebugEnabled()) { - super.debug(marker, contextualize(format), arguments); - } - } - - @Override - public void debug(Marker marker, String msg, Throwable t) { - if (isDebugEnabled()) { - super.debug(marker, contextualize(msg), t); - } - } - - @Override - public void info(String msg) { - if (isInfoEnabled()) { - super.info(contextualize(msg)); - } - } - - @Override - public void info(String format, Object arg) { - if (isInfoEnabled()) { - super.info(contextualize(format), arg); - } - } - - @Override - public void info(String format, Object arg1, Object arg2) { - if (isInfoEnabled()) { - super.info(contextualize(format), arg1, arg2); - } - } - - @Override - public void info(String format, Object... arguments) { - if (isInfoEnabled()) { - super.info(contextualize(format), arguments); - } - } - - @Override - public void info(String msg, Throwable t) { - if (isInfoEnabled()) { - super.info(contextualize(msg), t); - } - } - - @Override - public void info(Marker marker, String msg) { - if (isInfoEnabled()) { - super.info(marker, contextualize(msg)); - } - } - - @Override - public void info(Marker marker, String format, Object arg) { - if (isInfoEnabled()) { - super.info(marker, contextualize(format), arg); - } - } - - @Override - public void info(Marker marker, String format, Object arg1, Object arg2) { - if (isInfoEnabled()) { - super.info(marker, contextualize(format), arg1, arg2); - } - } - - @Override - public void info(Marker marker, String format, Object... arguments) { - if (isInfoEnabled()) { - super.info(marker, contextualize(format), arguments); - } - } - - @Override - public void info(Marker marker, String msg, Throwable t) { - if (isInfoEnabled()) { - super.info(marker, contextualize(msg), t); - } - } - - @Override - public void warn(String msg) { - if (isWarnEnabled()) { - super.warn(contextualize(msg)); - } - } - - @Override - public void warn(String format, Object arg) { - if (isWarnEnabled()) { - super.warn(contextualize(format), arg); - } - } - - @Override - public void warn(String format, Object... arguments) { - if (isWarnEnabled()) { - super.warn(contextualize(format), arguments); - } - } - - @Override - public void warn(String format, Object arg1, Object arg2) { - if (isWarnEnabled()) { - super.warn(contextualize(format), arg1, arg2); - } - } - - @Override - public void warn(String msg, Throwable t) { - if (isWarnEnabled()) { - super.warn(contextualize(msg), t); - } - } - - @Override - public void warn(Marker marker, String msg) { - if (isWarnEnabled()) { - super.warn(marker, contextualize(msg)); - } - } - - @Override - public void warn(Marker marker, String format, Object arg) { - if (isWarnEnabled()) { - super.warn(marker, contextualize(format), arg); - } - } - - @Override - public void warn(Marker marker, String format, Object arg1, Object arg2) { - if (isWarnEnabled()) { - super.warn(marker, contextualize(format), arg1, arg2); - } - } - - @Override - public void warn(Marker marker, String format, Object... arguments) { - if (isWarnEnabled()) { - super.warn(marker, contextualize(format), arguments); - } - } - - @Override - public void warn(Marker marker, String msg, Throwable t) { - if (isWarnEnabled()) { - super.warn(marker, contextualize(msg), t); - } - } - - @Override - public void error(String msg) { - if (isErrorEnabled()) { - super.error(contextualize(msg)); - } - } - - @Override - public void error(String format, Object arg) { - if (isErrorEnabled()) { - super.error(contextualize(format), arg); - } - } - - @Override - public void error(String format, Object arg1, Object arg2) { - if (isErrorEnabled()) { - super.error(contextualize(format), arg1, arg2); - } - } - - @Override - public void error(String format, Object... arguments) { - if (isErrorEnabled()) { - super.error(contextualize(format), arguments); - } - } - - @Override - public void error(String msg, Throwable t) { - if (isErrorEnabled()) { - super.error(contextualize(msg), t); - } - } - - @Override - public void error(Marker marker, String msg) { - if (isErrorEnabled()) { - super.error(marker, contextualize(msg)); - } - } - - @Override - public void error(Marker marker, String format, Object arg) { - if (isErrorEnabled()) { - super.error(marker, contextualize(format), arg); - } - } - - @Override - public void error(Marker marker, String format, Object arg1, Object arg2) { - if (isErrorEnabled()) { - super.error(marker, contextualize(format), arg1, arg2); - } - } - - @Override - public void error(Marker marker, String format, Object... arguments) { - if (isErrorEnabled()) { - super.error(marker, contextualize(format), arguments); - } - } - - @Override - public void error(Marker marker, String msg, Throwable t) { - if (isErrorEnabled()) { - super.error(marker, contextualize(msg), t); - } - } -} diff --git a/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/ContextualLoggerFactory.java b/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/ContextualLoggerFactory.java deleted file mode 100644 index c6e0f13fd6..0000000000 --- a/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/ContextualLoggerFactory.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2017-present Open Networking Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.atomix.utils.logging; - -import org.slf4j.LoggerFactory; - -/** - * Contextual logger factory. - */ -public class ContextualLoggerFactory { - - /** - * Returns a contextual logger. - * - * @param name the contextual logger name - * @param context the logger context - * @return the logger - */ - public static ContextualLogger getLogger(String name, LoggerContext context) { - return new ContextualLogger(LoggerFactory.getLogger(name), context); - } - - /** - * Returns a contextual logger. - * - * @param clazz the contextual logger class - * @param context the logger context - * @return the logger - */ - public static ContextualLogger getLogger(Class clazz, LoggerContext context) { - return new ContextualLogger(LoggerFactory.getLogger(clazz), context); - } - - private ContextualLoggerFactory() { - } -} diff --git a/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/DelegatingLogger.java b/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/DelegatingLogger.java deleted file mode 100644 index 09236d284a..0000000000 --- a/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/DelegatingLogger.java +++ /dev/null @@ -1,344 +0,0 @@ -/* - * Copyright 2017-present Open Networking Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.atomix.utils.logging; - -import org.slf4j.Logger; -import org.slf4j.Marker; - -import static com.google.common.base.MoreObjects.toStringHelper; - -/** - * Delegating logger. - */ -public class DelegatingLogger implements Logger { - private final Logger delegate; - - public DelegatingLogger(Logger delegate) { - this.delegate = delegate; - } - - @Override - public String getName() { - return delegate.getName(); - } - - @Override - public boolean isTraceEnabled() { - return delegate.isTraceEnabled(); - } - - @Override - public void trace(String msg) { - delegate.trace(msg); - } - - @Override - public void trace(String format, Object arg) { - delegate.trace(format, arg); - } - - @Override - public void trace(String format, Object arg1, Object arg2) { - delegate.trace(format, arg1, arg2); - } - - @Override - public void trace(String format, Object... arguments) { - delegate.trace(format, arguments); - } - - @Override - public void trace(String msg, Throwable t) { - delegate.trace(msg, t); - } - - @Override - public boolean isTraceEnabled(Marker marker) { - return delegate.isTraceEnabled(marker); - } - - @Override - public void trace(Marker marker, String msg) { - delegate.trace(marker, msg); - } - - @Override - public void trace(Marker marker, String format, Object arg) { - delegate.trace(marker, format, arg); - } - - @Override - public void trace(Marker marker, String format, Object arg1, Object arg2) { - delegate.trace(marker, format, arg1, arg2); - } - - @Override - public void trace(Marker marker, String format, Object... argArray) { - delegate.trace(marker, format, argArray); - } - - @Override - public void trace(Marker marker, String msg, Throwable t) { - delegate.trace(marker, msg, t); - } - - @Override - public boolean isDebugEnabled() { - return delegate.isDebugEnabled(); - } - - @Override - public void debug(String msg) { - delegate.debug(msg); - } - - @Override - public void debug(String format, Object arg) { - delegate.debug(format, arg); - } - - @Override - public void debug(String format, Object arg1, Object arg2) { - delegate.debug(format, arg1, arg2); - } - - @Override - public void debug(String format, Object... arguments) { - delegate.debug(format, arguments); - } - - @Override - public void debug(String msg, Throwable t) { - delegate.debug(msg, t); - } - - @Override - public boolean isDebugEnabled(Marker marker) { - return delegate.isDebugEnabled(marker); - } - - @Override - public void debug(Marker marker, String msg) { - delegate.debug(marker, msg); - } - - @Override - public void debug(Marker marker, String format, Object arg) { - delegate.debug(marker, format, arg); - } - - @Override - public void debug(Marker marker, String format, Object arg1, Object arg2) { - delegate.debug(marker, format, arg1, arg2); - } - - @Override - public void debug(Marker marker, String format, Object... arguments) { - delegate.debug(marker, format, arguments); - } - - @Override - public void debug(Marker marker, String msg, Throwable t) { - delegate.debug(marker, msg, t); - } - - @Override - public boolean isInfoEnabled() { - return delegate.isInfoEnabled(); - } - - @Override - public void info(String msg) { - delegate.info(msg); - } - - @Override - public void info(String format, Object arg) { - delegate.info(format, arg); - } - - @Override - public void info(String format, Object arg1, Object arg2) { - delegate.info(format, arg1, arg2); - } - - @Override - public void info(String format, Object... arguments) { - delegate.info(format, arguments); - } - - @Override - public void info(String msg, Throwable t) { - delegate.info(msg, t); - } - - @Override - public boolean isInfoEnabled(Marker marker) { - return delegate.isInfoEnabled(marker); - } - - @Override - public void info(Marker marker, String msg) { - delegate.info(marker, msg); - } - - @Override - public void info(Marker marker, String format, Object arg) { - delegate.info(marker, format, arg); - } - - @Override - public void info(Marker marker, String format, Object arg1, Object arg2) { - delegate.info(marker, format, arg1, arg2); - } - - @Override - public void info(Marker marker, String format, Object... arguments) { - delegate.info(marker, format, arguments); - } - - @Override - public void info(Marker marker, String msg, Throwable t) { - delegate.info(marker, msg, t); - } - - @Override - public boolean isWarnEnabled() { - return delegate.isWarnEnabled(); - } - - @Override - public void warn(String msg) { - delegate.warn(msg); - } - - @Override - public void warn(String format, Object arg) { - delegate.warn(format, arg); - } - - @Override - public void warn(String format, Object... arguments) { - delegate.warn(format, arguments); - } - - @Override - public void warn(String format, Object arg1, Object arg2) { - delegate.warn(format, arg1, arg2); - } - - @Override - public void warn(String msg, Throwable t) { - delegate.warn(msg, t); - } - - @Override - public boolean isWarnEnabled(Marker marker) { - return delegate.isWarnEnabled(marker); - } - - @Override - public void warn(Marker marker, String msg) { - delegate.warn(marker, msg); - } - - @Override - public void warn(Marker marker, String format, Object arg) { - delegate.warn(marker, format, arg); - } - - @Override - public void warn(Marker marker, String format, Object arg1, Object arg2) { - delegate.warn(marker, format, arg1, arg2); - } - - @Override - public void warn(Marker marker, String format, Object... arguments) { - delegate.warn(marker, format, arguments); - } - - @Override - public void warn(Marker marker, String msg, Throwable t) { - delegate.warn(marker, msg, t); - } - - @Override - public boolean isErrorEnabled() { - return delegate.isErrorEnabled(); - } - - @Override - public void error(String msg) { - delegate.error(msg); - } - - @Override - public void error(String format, Object arg) { - delegate.error(format, arg); - } - - @Override - public void error(String format, Object arg1, Object arg2) { - delegate.error(format, arg1, arg2); - } - - @Override - public void error(String format, Object... arguments) { - delegate.error(format, arguments); - } - - @Override - public void error(String msg, Throwable t) { - delegate.error(msg, t); - } - - @Override - public boolean isErrorEnabled(Marker marker) { - return delegate.isErrorEnabled(marker); - } - - @Override - public void error(Marker marker, String msg) { - delegate.error(marker, msg); - } - - @Override - public void error(Marker marker, String format, Object arg) { - delegate.error(marker, format, arg); - } - - @Override - public void error(Marker marker, String format, Object arg1, Object arg2) { - delegate.error(marker, format, arg1, arg2); - } - - @Override - public void error(Marker marker, String format, Object... arguments) { - delegate.error(marker, format, arguments); - } - - @Override - public void error(Marker marker, String msg, Throwable t) { - delegate.error(marker, msg, t); - } - - @Override - public String toString() { - return toStringHelper(this) - .addValue(delegate) - .toString(); - } -} diff --git a/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/LoggerContext.java b/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/LoggerContext.java deleted file mode 100644 index 1ba99e6021..0000000000 --- a/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/LoggerContext.java +++ /dev/null @@ -1,266 +0,0 @@ -/* - * Copyright 2017-present Open Networking Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.atomix.utils.logging; - -import com.google.common.base.MoreObjects; -import com.google.errorprone.annotations.CanIgnoreReturnValue; - -import java.util.function.Supplier; - -/** - * Logger context. - */ -public class LoggerContext { - - /** - * Returns a new contextual logger builder. - * - * @param name the logger name - * @return the logger builder - */ - public static Builder builder(String name) { - return new Builder(name); - } - - /** - * Returns a new contextual logger builder. - * - * @param clazz the logger class - * @return the logger builder - */ - public static Builder builder(Class clazz) { - return new Builder(clazz.getSimpleName()); - } - - private final Supplier stringProvider; - - public LoggerContext(Supplier stringProvider) { - this.stringProvider = stringProvider; - } - - @Override - public String toString() { - return stringProvider.get(); - } - - /** - * Contextual logger builder. - */ - public static class Builder implements io.atomix.utils.Builder { - private final MoreObjects.ToStringHelper identityStringHelper; - private MoreObjects.ToStringHelper argsStringHelper; - private boolean omitNullValues = false; - - public Builder(String name) { - this.identityStringHelper = MoreObjects.toStringHelper(name); - } - - /** - * Initializes the arguments string helper. - */ - private void initializeArgs() { - if (argsStringHelper == null) { - argsStringHelper = MoreObjects.toStringHelper(""); - } - } - - /** - * Configures the {@link MoreObjects.ToStringHelper} so {@link #toString()} will ignore properties with null - * value. The order of calling this method, relative to the {@code add()}/{@code addValue()} - * methods, is not significant. - */ - @CanIgnoreReturnValue - public Builder omitNullValues() { - this.omitNullValues = true; - return this; - } - - /** - * Adds a name/value pair to the formatted output in {@code name=value} format. If {@code value} - * is {@code null}, the string {@code "null"} is used, unless {@link #omitNullValues()} is - * called, in which case this name/value pair will not be added. - */ - @CanIgnoreReturnValue - public Builder add(String name, Object value) { - initializeArgs(); - argsStringHelper.add(name, value); - return this; - } - - /** - * Adds a name/value pair to the formatted output in {@code name=value} format. - */ - @CanIgnoreReturnValue - public Builder add(String name, boolean value) { - initializeArgs(); - argsStringHelper.add(name, value); - return this; - } - - /** - * Adds a name/value pair to the formatted output in {@code name=value} format. - */ - @CanIgnoreReturnValue - public Builder add(String name, char value) { - initializeArgs(); - argsStringHelper.add(name, value); - return this; - } - - /** - * Adds a name/value pair to the formatted output in {@code name=value} format. - */ - @CanIgnoreReturnValue - public Builder add(String name, double value) { - initializeArgs(); - argsStringHelper.add(name, value); - return this; - } - - /** - * Adds a name/value pair to the formatted output in {@code name=value} format. - */ - @CanIgnoreReturnValue - public Builder add(String name, float value) { - initializeArgs(); - argsStringHelper.add(name, value); - return this; - } - - /** - * Adds a name/value pair to the formatted output in {@code name=value} format. - */ - @CanIgnoreReturnValue - public Builder add(String name, int value) { - initializeArgs(); - argsStringHelper.add(name, value); - return this; - } - - /** - * Adds a name/value pair to the formatted output in {@code name=value} format. - */ - @CanIgnoreReturnValue - public Builder add(String name, long value) { - initializeArgs(); - argsStringHelper.add(name, value); - return this; - } - - /** - * Adds an unnamed value to the formatted output. - * - *

It is strongly encouraged to use {@link #add(String, Object)} instead and give value a - * readable name. - */ - @CanIgnoreReturnValue - public Builder addValue(Object value) { - identityStringHelper.addValue(value); - return this; - } - - /** - * Adds an unnamed value to the formatted output. - * - *

It is strongly encouraged to use {@link #add(String, boolean)} instead and give value a - * readable name. - */ - @CanIgnoreReturnValue - public Builder addValue(boolean value) { - identityStringHelper.addValue(value); - return this; - } - - /** - * Adds an unnamed value to the formatted output. - * - *

It is strongly encouraged to use {@link #add(String, char)} instead and give value a - * readable name. - */ - @CanIgnoreReturnValue - public Builder addValue(char value) { - identityStringHelper.addValue(value); - return this; - } - - /** - * Adds an unnamed value to the formatted output. - * - *

It is strongly encouraged to use {@link #add(String, double)} instead and give value a - * readable name. - */ - @CanIgnoreReturnValue - public Builder addValue(double value) { - identityStringHelper.addValue(value); - return this; - } - - /** - * Adds an unnamed value to the formatted output. - * - *

It is strongly encouraged to use {@link #add(String, float)} instead and give value a - * readable name. - */ - @CanIgnoreReturnValue - public Builder addValue(float value) { - identityStringHelper.addValue(value); - return this; - } - - /** - * Adds an unnamed value to the formatted output. - * - *

It is strongly encouraged to use {@link #add(String, int)} instead and give value a - * readable name. - */ - @CanIgnoreReturnValue - public Builder addValue(int value) { - identityStringHelper.addValue(value); - return this; - } - - /** - * Adds an unnamed value to the formatted output. - * - *

It is strongly encouraged to use {@link #add(String, long)} instead and give value a - * readable name. - */ - @CanIgnoreReturnValue - public Builder addValue(long value) { - identityStringHelper.addValue(value); - return this; - } - - @Override - public LoggerContext build() { - MoreObjects.ToStringHelper identityStringHelper = this.identityStringHelper; - MoreObjects.ToStringHelper argsStringHelper = this.argsStringHelper; - if (omitNullValues) { - identityStringHelper.omitNullValues(); - if (argsStringHelper != null) { - argsStringHelper.omitNullValues(); - } - } - return new LoggerContext(() -> { - if (argsStringHelper == null) { - return identityStringHelper.toString(); - } else { - return identityStringHelper.toString() + argsStringHelper.toString(); - } - }); - } - } -} diff --git a/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/package-info.java b/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/package-info.java deleted file mode 100644 index 823cde28ce..0000000000 --- a/third-party/atomix/utils/src/main/java/io/atomix/utils/logging/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2018-present Open Networking Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Provides utility classes for logging in complex objects. - */ -package io.atomix.utils.logging; diff --git a/third-party/atomix/utils/src/test/java/io/atomix/utils/logging/LoggerContextTest.java b/third-party/atomix/utils/src/test/java/io/atomix/utils/logging/LoggerContextTest.java deleted file mode 100644 index df4ae40cca..0000000000 --- a/third-party/atomix/utils/src/test/java/io/atomix/utils/logging/LoggerContextTest.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * Copyright 2017-present Open Networking Foundation - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package io.atomix.utils.logging; - -import org.junit.Test; - -import static org.junit.Assert.assertEquals; - -/** - * Contextual logger test. - */ -public class LoggerContextTest { - @Test - public void testLoggerContext() throws Exception { - LoggerContext context = LoggerContext.builder("test") - .addValue(1) - .add("foo", "bar") - .build(); - assertEquals("test{1}{foo=bar}", context.toString()); - } -}