Skip to content

Commit f1d3f82

Browse files
committed
Drop vendored Logger/LoggerFactory wrapper; use SLF4J + Logback directly
The OSInfo resync from xerial/sqlite-jdbc brought a same-package Logger / LoggerFactory pair that re-implemented a tiny SLF4J facade. For this project that wrapper is dead weight: depending on slf4j-api directly and shipping logback-classic at runtime scope gives the same behaviour with no hand-maintained code. Changes: - Delete src/main/java/net/ladenthin/llama/Logger.java - Delete src/main/java/net/ladenthin/llama/LoggerFactory.java - OSInfo.java: import org.slf4j.Logger / org.slf4j.LoggerFactory directly. Drop the Supplier<String> lazy form at the two LogHolder.logger call sites in getHardwareName() and resolveArmArchType() (both messages are constant strings, so eager construction is free). Header comment lists this as a third documented deviation from the upstream sqlite-jdbc file. - pom.xml: slf4j-api 2.0.18 -> non-optional (compile). Add logback-classic 1.5.32 at runtime scope as the default binding. AndroidSignatureIgnore.java is kept as-is — it is a marker annotation, not a logging shim, and removing it would add a 4th deviation from upstream for no gain. Verified: - mvn clean compile: BUILD SUCCESS - mvn test -Dtest=OSInfoTest,LlamaLoaderTest: 37/37 pass - mvn dependency:tree: slf4j-api:compile, logback-classic:runtime, logback-core:runtime (transitive). No duplicate binding. - reuse lint: 138/138 files compliant with REUSE 3.3.
1 parent 65c6256 commit f1d3f82

4 files changed

Lines changed: 18 additions & 149 deletions

File tree

‎pom.xml‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,19 @@ SPDX-License-Identifier: MIT
7373
<artifactId>jackson-databind</artifactId>
7474
<version>2.21.3</version>
7575
</dependency>
76-
<!-- Required by the vendored OSInfo/LoggerFactory (from xerial/sqlite-jdbc).
77-
Optional: LoggerFactory falls back to java.util.logging when SLF4J is absent at runtime. -->
76+
<!-- Required by OSInfo (vendored from xerial/sqlite-jdbc) for log emission. -->
7877
<dependency>
7978
<groupId>org.slf4j</groupId>
8079
<artifactId>slf4j-api</artifactId>
8180
<version>2.0.18</version>
82-
<optional>true</optional>
81+
</dependency>
82+
<!-- Default SLF4J binding shipped with this library. Runtime scope: not
83+
required on the compile classpath, only loaded at JVM startup. -->
84+
<dependency>
85+
<groupId>ch.qos.logback</groupId>
86+
<artifactId>logback-classic</artifactId>
87+
<version>1.5.32</version>
88+
<scope>runtime</scope>
8389
</dependency>
8490
</dependencies>
8591

‎src/main/java/net/ladenthin/llama/Logger.java‎

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎src/main/java/net/ladenthin/llama/LoggerFactory.java‎

Lines changed: 0 additions & 119 deletions
This file was deleted.

‎src/main/java/net/ladenthin/llama/OSInfo.java‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@
2727
// 1. package org.sqlite.util -> package net.ladenthin.llama
2828
// 2. system property "org.sqlite.osinfo.architecture"
2929
// -> "net.ladenthin.llama.osinfo.architecture"
30+
// 3. internal Logger / LoggerFactory (sqlite-jdbc's same-package
31+
// wrapper) -> org.slf4j.Logger / org.slf4j.LoggerFactory
32+
// and drop the Supplier<String> lazy form (the two messages
33+
// are constant strings, so eager construction is free).
3034
// The original Apache-2.0 copyright header from the upstream file is
3135
// preserved verbatim below.
3236

@@ -65,6 +69,9 @@
6569
import java.util.Locale;
6670
import java.util.stream.Stream;
6771

72+
import org.slf4j.Logger;
73+
import org.slf4j.LoggerFactory;
74+
6875
/**
6976
* Provides OS name and architecture name.
7077
*
@@ -212,7 +219,7 @@ static String getHardwareName() {
212219
try {
213220
return processRunner.runAndWaitFor("uname -m");
214221
} catch (Throwable e) {
215-
LogHolder.logger.error(() -> "Error while running uname -m", e);
222+
LogHolder.logger.error("Error while running uname -m", e);
216223
return "unknown";
217224
}
218225
}
@@ -280,8 +287,7 @@ static String resolveArmArchType() {
280287
}
281288
} else {
282289
LogHolder.logger.warn(
283-
() ->
284-
"readelf not found. Cannot check if running on an armhf system, armel architecture will be presumed");
290+
"readelf not found. Cannot check if running on an armhf system, armel architecture will be presumed");
285291
}
286292
} catch (IOException | InterruptedException e) {
287293
// ignored: fall back to "arm" arch (soft-float ABI)

0 commit comments

Comments
 (0)