Skip to content

Commit

Permalink
Implement java.util.logging bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
andrzejressel committed May 26, 2024
1 parent 8f8e8d4 commit 57f3901
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
32 changes: 16 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,36 +85,36 @@ jobs:
uses: actions/checkout@v3.3.0
with:
fetch-depth: '0'
- name: Test
if: ${{ (matrix.java == '17') && (matrix.scala == '3.3.0') }}
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test julBridge/test slf4j2Bridge/test coreJS/test coreJVM/test '
- name: Test
if: ${{ (matrix.java == '17') && (matrix.scala == '2.13.10') }}
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test slf4j2Bridge/test coreJS/test coreJVM/test '
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test julBridge/test slf4j2Bridge/test coreJS/test coreJVM/test '
- name: Test
if: ${{ (matrix.java == '8') && (matrix.scala == '2.13.10') }}
run: 'sbt ++${{ matrix.scala }} coreJS/test slf4jBridge/test coreJVM/test slf4j/test '
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test julBridge/test coreJS/test coreJVM/test '
- name: Test
if: ${{ (matrix.java == '8') && (matrix.scala == '2.12.17') }}
run: 'sbt ++${{ matrix.scala }} coreJS/test slf4jBridge/test coreJVM/test slf4j/test '
if: ${{ (matrix.java == '17') && (matrix.scala == '2.12.17') }}
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test julBridge/test slf4j2Bridge/test coreJS/test coreJVM/test '
- name: Test
if: ${{ (matrix.java == '11') && (matrix.scala == '3.3.0') }}
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test slf4j2Bridge/test coreJS/test coreJVM/test '
- name: Test
if: ${{ (matrix.java == '11') && (matrix.scala == '2.12.17') }}
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test slf4j2Bridge/test coreJS/test coreJVM/test '
- name: Test
if: ${{ (matrix.java == '17') && (matrix.scala == '2.12.17') }}
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test slf4j2Bridge/test coreJS/test coreJVM/test '
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test julBridge/test slf4j2Bridge/test coreJS/test coreJVM/test '
- name: Test
if: ${{ (matrix.java == '11') && (matrix.scala == '2.13.10') }}
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test slf4j2Bridge/test coreJS/test coreJVM/test '
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test julBridge/test slf4j2Bridge/test coreJS/test coreJVM/test '
- name: Test
if: ${{ (matrix.java == '17') && (matrix.scala == '3.3.0') }}
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test slf4j2Bridge/test coreJS/test coreJVM/test '
if: ${{ (matrix.java == '11') && (matrix.scala == '2.12.17') }}
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test jpl/test slf4j2/test julBridge/test slf4j2Bridge/test coreJS/test coreJVM/test '
- name: Test
if: ${{ (matrix.java == '8') && (matrix.scala == '2.12.17') }}
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test julBridge/test coreJS/test coreJVM/test '
- name: Test
if: ${{ (matrix.java == '8') && (matrix.scala == '3.3.0') }}
run: 'sbt ++${{ matrix.scala }} coreJS/test slf4jBridge/test coreJVM/test slf4j/test '
run: 'sbt ++${{ matrix.scala }} slf4j/test slf4jBridge/test julBridge/test coreJS/test coreJVM/test '
- name: Compile additional subprojects
if: ${{ ((startsWith(matrix.scala, '2.12.')) || (startsWith(matrix.scala, '2.13.'))) && (matrix.java == '11') }}
run: sbt ++${{ matrix.scala }} examplesCore/compile examplesJpl/compile examplesSlf4j2Bridge/compile examplesSlf4jLogback/compile examplesSlf4j2Logback/compile examplesSlf4j2Log4j/compile benchmarks/compile
run: sbt ++${{ matrix.scala }} examplesCore/compile examplesJpl/compile examplesSlf4j2Bridge/compile examplesSlf4jLogback/compile examplesSlf4j2Logback/compile examplesSlf4j2Log4j/compile examplesJulBridge/compile benchmarks/compile
ci:
name: ci
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions docs/slf4j2-bridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ libraryDependencies += "dev.zio" %% "zio-logging-slf4j2-bridge" % "@VERSION@"
and use one of the `Slf4jBridge` layers when setting up logging:

```scala
import zio.logging.slf4j.bridge.Slf4jBridge
import zio.logging.slf4j.Slf4jBridge

program.provideCustom(Slf4jBridge.init())
```
Expand All @@ -31,7 +31,7 @@ logging parts may contain message and log parameters construction, which may be
SLF4J logger name is stored in log annotation with key `logger_name` (`zio.logging.loggerNameAnnotationKey`), following log format

```scala
import zio.logging.slf4j.bridge.Slf4jBridge
import zio.logging.slf4j.Slf4jBridge
import zio.logging.LoggerNameExtractor

val loggerName = LoggerNameExtractor.loggerNameAnnotationOrTrace
Expand All @@ -55,7 +55,7 @@ val logFilter: LogFilter[String] = logFilterConfig.toFilter
SLF4J bridge with custom logger can be setup:

```scala
import zio.logging.slf4j.bridge.Slf4jBridge
import zio.logging.slf4j.Slf4jBridge
import zio.logging.consoleJsonLogger

val logger = Runtime.removeDefaultLoggers >>> consoleJsonLogger() >+> Slf4jBridge.init()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ package zio.logging.jul.bridge
import zio.logging.LogFilter
import zio.{ Cause, Fiber, FiberId, FiberRef, FiberRefs, LogLevel, Runtime, Trace, Unsafe }

import java.util.logging.{ Handler, LogRecord, Level }
import java.util.logging.{Handler, Level, LogRecord}

final class ZioLoggerRuntime(runtime: Runtime[Any], filter: LogFilter[Any]) extends Handler {

Expand Down

0 comments on commit 57f3901

Please sign in to comment.