-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This implements the new SLF4JServiceProvider interface, and registers it with a ServiceLoader, as explained here: https://www.slf4j.org/faq.html#changesInVersion200 It depends on the old module and exposes the new interface, and will be picked up first when running on SLF4J versions 2 and above.
- Loading branch information
1 parent
5076f09
commit ae2cbbb
Showing
4 changed files
with
62 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
modules/odin-slf4j2-bridge/src/main/java/org/slf4j/impl/OdinBridge.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Copyright 2022-2024 Permutive Ltd. <https://permutive.com> | ||
* | ||
* 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 org.slf4j.impl; | ||
|
||
import com.permutive.logging.slf4j.odin.LoggerFactory; | ||
import org.slf4j.ILoggerFactory; | ||
import org.slf4j.IMarkerFactory; | ||
import org.slf4j.helpers.BasicMDCAdapter; | ||
import org.slf4j.spi.MDCAdapter; | ||
import org.slf4j.spi.SLF4JServiceProvider; | ||
|
||
|
||
public class OdinBridge implements SLF4JServiceProvider { | ||
|
||
@Override | ||
public ILoggerFactory getLoggerFactory() { | ||
return new LoggerFactory(); | ||
} | ||
|
||
@Override | ||
public IMarkerFactory getMarkerFactory() { | ||
return null; | ||
} | ||
|
||
@Override | ||
public MDCAdapter getMDCAdapter() { | ||
return new BasicMDCAdapter(); | ||
} | ||
|
||
@Override | ||
public String getRequestedApiVersion() { | ||
return "2.0"; | ||
} | ||
|
||
@Override | ||
public void initialize() { | ||
|
||
} | ||
} |
1 change: 1 addition & 0 deletions
1
...din-slf4j2-bridge/src/main/resources/META-INF/services/org.slf4j.spi.SLF4JServiceProvider
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
org.slf4j.impl.OdinBridge |