From a707b212009d158c0bc8adc77abdc66ca1b7c94e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Mathieu?= Date: Wed, 11 Sep 2024 19:40:22 +0200 Subject: [PATCH] Optimize level mapping by using comparison on intValue() --- .../runtime/logs/OpenTelemetryLogHandler.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/logs/OpenTelemetryLogHandler.java b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/logs/OpenTelemetryLogHandler.java index 8e4bc4584ad68..fac4767b6cc78 100644 --- a/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/logs/OpenTelemetryLogHandler.java +++ b/extensions/opentelemetry/runtime/src/main/java/io/quarkus/opentelemetry/runtime/logs/OpenTelemetryLogHandler.java @@ -53,19 +53,19 @@ public void publish(LogRecord record) { } private Severity mapSeverity(Level level) { - if (Level.SEVERE.equals(level)) { + if (level.intValue() == Level.SEVERE.intValue()) { return Severity.ERROR; } - if (Level.WARNING.equals(level)) { + if (level.intValue() == Level.WARNING.intValue()) { return Severity.WARN; } - if (Level.INFO.equals(level) || Level.CONFIG.equals(level)) { + if (level.intValue() <= Level.INFO.intValue() && level.intValue() >= Level.CONFIG.intValue()) { return Severity.INFO; } - if (Level.FINE.equals(level)) { + if (level.intValue() == Level.FINE.intValue()) { return Severity.DEBUG; } - if (Level.FINER.equals(level) || Level.FINEST.equals(level) || Level.ALL.equals(level)) { + if (level.intValue() <= Level.FINER.intValue()) { return Severity.TRACE; } return Severity.UNDEFINED_SEVERITY_NUMBER;