Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: zio/zio-logging
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.4.0
Choose a base ref
...
head repository: zio/zio-logging
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.5.0
Choose a head ref

Commits on Nov 14, 2024

  1. Copy the full SHA
    1eb2454 View commit details
  2. Update README.md (#907)

    Co-authored-by: ZIO Assistant <zio-assistant[bot]@users.noreply.github.com>
    zio-assistant[bot] and zio-assistant[bot] authored Nov 14, 2024
    Copy the full SHA
    2b72b7b View commit details

Commits on Nov 24, 2024

  1. Copy the full SHA
    d870ef4 View commit details
  2. Update zio, zio-streams, zio-test, ... to 2.1.13 (#910)

    Co-authored-by: Peter Kotula <peto.kotula@yahoo.com>
    scala-steward and justcoon authored Nov 24, 2024
    Copy the full SHA
    803b5ec View commit details
  3. Update zio-prelude to 1.0.0-RC35 (#912)

    Co-authored-by: Peter Kotula <peto.kotula@yahoo.com>
    scala-steward and justcoon authored Nov 24, 2024
    Copy the full SHA
    05e2c34 View commit details
  4. Update log4j-core, log4j-slf4j2-impl to 2.24.2 (#913)

    Co-authored-by: Peter Kotula <peto.kotula@yahoo.com>
    scala-steward and justcoon authored Nov 24, 2024
    Copy the full SHA
    450254a View commit details

Commits on Dec 2, 2024

  1. Copy the full SHA
    ba668b8 View commit details

Commits on Dec 6, 2024

  1. build(core): support scala native + enabled JS tests (#909)

    * build(core): support scala native
    
    * add .jvmopts (JDK_JAVA_OPTIONS not working)
    
    * fix scala-js scala-java-time dependencies
    
    * wait longer for config to reconfigure logger
    
    * update docs
    ThijsBroersen authored Dec 6, 2024
    Copy the full SHA
    7934eba View commit details
  2. Update README.md (#915)

    Co-authored-by: ZIO Assistant <zio-assistant[bot]@users.noreply.github.com>
    zio-assistant[bot] and zio-assistant[bot] authored Dec 6, 2024
    Copy the full SHA
    7be476f View commit details

Commits on Dec 17, 2024

  1. Copy the full SHA
    c7228e4 View commit details

Commits on Dec 28, 2024

  1. Copy the full SHA
    5ef46f9 View commit details

Commits on Jan 1, 2025

  1. Copy the full SHA
    852c269 View commit details

Commits on Jan 4, 2025

  1. Copy the full SHA
    2c2d7bb View commit details

Commits on Jan 5, 2025

  1. Copy the full SHA
    0a8fa19 View commit details

Commits on Jan 13, 2025

  1. Copy the full SHA
    c6e67cd View commit details
  2. Update sbt-scalajs, scalajs-compiler, ... to 1.18.1 (#927)

    Co-authored-by: Peter Kotula <peto.kotula@yahoo.com>
    scala-steward and justcoon authored Jan 13, 2025
    Copy the full SHA
    aea9976 View commit details

Commits on Jan 19, 2025

  1. Copy the full SHA
    bbc8345 View commit details

Commits on Jan 25, 2025

  1. Copy the full SHA
    d1e622a View commit details

Commits on Jan 27, 2025

  1. Copy the full SHA
    5852760 View commit details
  2. Update sbt-scalajs, scalajs-compiler, ... to 1.18.2 (#932)

    Co-authored-by: Peter Kotula <peto.kotula@yahoo.com>
    scala-steward and justcoon authored Jan 27, 2025
    Copy the full SHA
    519b330 View commit details

Commits on Feb 4, 2025

  1. Copy the full SHA
    be23867 View commit details

Commits on Feb 6, 2025

  1. Copy the full SHA
    ee2293a View commit details

Commits on Feb 8, 2025

  1. Copy the full SHA
    32b8e8d View commit details

Commits on Feb 12, 2025

  1. Copy the full SHA
    940ee96 View commit details

Commits on Feb 13, 2025

  1. Copy the full SHA
    1bc7fad View commit details

Commits on Feb 19, 2025

  1. Copy the full SHA
    6389290 View commit details
Showing with 420 additions and 297 deletions.
  1. +18 −3 .github/workflows/ci.yml
  2. +4 −0 .jvmopts
  3. +1 −1 .scalafmt.conf
  4. +8 −8 README.md
  5. +32 −11 build.sbt
  6. +18 −0 core/js/src/main/scala/zio/logging/LoggingPackagePlatformSpecific.scala
  7. +170 −0 core/jvm-native/src/main/scala/zio/logging/FileLoggerLayers.scala
  8. +18 −0 core/jvm-native/src/main/scala/zio/logging/LoggingPackagePlatformSpecific.scala
  9. 0 core/{shared → jvm-native}/src/main/scala/zio/logging/internal/FileWriter.scala
  10. 0 core/{shared → jvm-native}/src/main/scala/zio/logging/internal/WriterProvider.scala
  11. 0 core/{jvm → jvm-native}/src/test/scala/zio/logging/FileLoggerConfigSpec.scala
  12. 0 core/{jvm → jvm-native}/src/test/scala/zio/logging/internal/WriterProviderSpec.scala
  13. +12 −10 core/shared/src/main/scala/zio/logging/LogFormat.scala
  14. +1 −148 core/shared/src/main/scala/zio/logging/LoggerLayers.scala
  15. +12 −10 core/shared/src/main/scala/zio/logging/LoggerNameExtractor.scala
  16. +95 −0 core/shared/src/main/scala/zio/logging/LoggingPackageAllPlatforms.scala
  17. +1 −1 core/shared/src/main/scala/zio/logging/internal/LogAppender.scala
  18. +1 −77 core/shared/src/main/scala/zio/logging/package.scala
  19. +0 −1 core/{jvm → shared}/src/test/scala/zio/logging/AppendLoggerNameSpec.scala
  20. 0 core/{jvm → shared}/src/test/scala/zio/logging/ConsoleLoggerConfigSpec.scala
  21. 0 core/{jvm → shared}/src/test/scala/zio/logging/JsonGenerator.scala
  22. +2 −2 core/{jvm → shared}/src/test/scala/zio/logging/JsonLogFormatSpec.scala
  23. +1 −1 core/{jvm → shared}/src/test/scala/zio/logging/LogAnnotationSpec.scala
  24. +1 −1 core/{jvm → shared}/src/test/scala/zio/logging/LogFilterSpec.scala
  25. 0 core/{jvm → shared}/src/test/scala/zio/logging/LogFormatPatternSpec.scala
  26. +1 −1 core/{jvm → shared}/src/test/scala/zio/logging/LogFormatSpec.scala
  27. +5 −5 core/{jvm → shared}/src/test/scala/zio/logging/LogGroupSpec.scala
  28. +3 −3 core/{jvm → shared}/src/test/scala/zio/logging/LoggerNameExtractorSpec.scala
  29. 0 core/{jvm → shared}/src/test/scala/zio/logging/MetricsSpec.scala
  30. +2 −2 core/{jvm → shared}/src/test/scala/zio/logging/ReconfigurableLoggerSpec.scala
  31. 0 core/{jvm → shared}/src/test/scala/zio/logging/internal/JsonValidatorSpec.scala
  32. 0 core/{jvm → shared}/src/test/scala/zio/logging/test/TestService.scala
  33. +1 −1 docs/index.md
  34. 0 examples/core/{ → jvm}/src/main/resources/logger.conf
  35. 0 examples/core/{ → jvm}/src/main/scala/zio/logging/api/http/ApiDomain.scala
  36. 0 examples/core/{ → jvm}/src/main/scala/zio/logging/api/http/ApiEndpoints.scala
  37. 0 examples/core/{ → jvm}/src/main/scala/zio/logging/api/http/ApiHandlers.scala
  38. 0 examples/core/{ → jvm}/src/main/scala/zio/logging/example/ConfigurableLoggerApp.scala
  39. 0 examples/core/{ → jvm}/src/main/scala/zio/logging/example/ConsoleColoredApp.scala
  40. 0 examples/core/{ → jvm}/src/main/scala/zio/logging/example/ConsoleJsonApp.scala
  41. 0 examples/core/{ → jvm}/src/main/scala/zio/logging/example/FileApp.scala
  42. 0 examples/core/{ → jvm}/src/main/scala/zio/logging/example/LoggerReconfigureApp.scala
  43. 0 examples/core/{ → jvm}/src/main/scala/zio/logging/example/MetricsApp.scala
  44. 0 examples/core/{ → jvm}/src/main/scala/zio/logging/example/PingService.scala
  45. 0 examples/core/{ → jvm}/src/test/scala/zio/logging/api/http/ApiEndpointsSpec.scala
  46. 0 examples/core/{ → jvm}/src/test/scala/zio/logging/api/http/ApiHandlersSpec.scala
  47. 0 examples/core/{ → jvm}/src/test/scala/zio/logging/example/PingServiceSpec.scala
  48. 0 examples/core/{ → shared}/src/main/scala/zio/logging/ConfigurableLogger.scala
  49. +2 −2 examples/core/{ → shared}/src/main/scala/zio/logging/example/SimpleApp.scala
  50. 0 examples/core/{ → shared}/src/test/scala/zio/logging/example/LoggingSpec.scala
  51. +1 −1 project/MimaSettings.scala
  52. +5 −5 project/Versions.scala
  53. +1 −1 project/build.properties
  54. +4 −2 project/plugins.sbt
21 changes: 18 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -15,6 +15,9 @@ env:
pull_request:
branches-ignore:
- gh-pages
concurrency:
group: ${{ github.workflow }}-${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) && github.run_id || github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build
@@ -33,6 +36,8 @@ jobs:
distribution: corretto
java-version: '17'
check-latest: true
- name: Setup SBT
uses: sbt/setup-sbt@v1
- name: Cache Dependencies
uses: coursier/cache-action@v6
- name: Check all code compiles
@@ -58,6 +63,8 @@ jobs:
distribution: corretto
java-version: '17'
check-latest: true
- name: Setup SBT
uses: sbt/setup-sbt@v1
- name: Cache Dependencies
uses: coursier/cache-action@v6
- name: Check if the site workflow is up to date
@@ -84,6 +91,8 @@ jobs:
distribution: corretto
java-version: ${{ matrix.java }}
check-latest: true
- name: Setup SBT
uses: sbt/setup-sbt@v1
- name: Cache Dependencies
uses: coursier/cache-action@v6
- name: Git Checkout
@@ -101,7 +110,7 @@ jobs:
matrix:
scala:
- 2.12.19
- 2.13.15
- 2.13.16
- 3.3.3
steps:
- name: Install libuv
@@ -119,7 +128,7 @@ jobs:
with:
fetch-depth: '0'
- name: Compile additional subprojects
run: sbt ++${{ matrix.scala }} examplesCore/compile examplesJpl/compile examplesJulBridge/compile examplesSlf4j2Bridge/compile examplesSlf4jLogback/compile examplesSlf4j2Logback/compile examplesSlf4j2Log4j/compile benchmarks/compile
run: sbt ++${{ matrix.scala }} examplesCoreJVM/compile examplesCoreJS/compile examplesCoreNative/compile examplesJpl/compile examplesJulBridge/compile examplesSlf4j2Bridge/compile examplesSlf4jLogback/compile examplesSlf4j2Logback/compile examplesSlf4j2Log4j/compile benchmarks/compile
update-readme:
name: Update README
runs-on: ubuntu-22.04
@@ -138,6 +147,8 @@ jobs:
distribution: corretto
java-version: '17'
check-latest: true
- name: Setup SBT
uses: sbt/setup-sbt@v1
- name: Cache Dependencies
uses: coursier/cache-action@v6
- name: Generate Readme
@@ -156,7 +167,7 @@ jobs:
app_private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
uses: peter-evans/create-pull-request@v7
with:
body: |-
Autogenerated changes after running the `sbt docs/generateReadme` command of the [zio-sbt-website](https://zio.dev/zio-sbt) plugin.
@@ -213,6 +224,8 @@ jobs:
distribution: corretto
java-version: '17'
check-latest: true
- name: Setup SBT
uses: sbt/setup-sbt@v1
- name: Cache Dependencies
uses: coursier/cache-action@v6
- name: Release
@@ -242,6 +255,8 @@ jobs:
distribution: corretto
java-version: '17'
check-latest: true
- name: Setup SBT
uses: sbt/setup-sbt@v1
- name: Cache Dependencies
uses: coursier/cache-action@v6
- name: Setup NodeJs
4 changes: 4 additions & 0 deletions .jvmopts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
-XX:+PrintCommandLineFlags
-Xss2m
-Xmx6g
-XX:+UseG1GC
2 changes: 1 addition & 1 deletion .scalafmt.conf
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
version = "3.8.3"
version = "3.9.0"
runner.dialect = scala212
maxColumn = 120
align.preset = most
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ When we are writing our applications using ZIO effects, to log easy way we need
Key features of ZIO Logging:

- **ZIO Native** — Other than it is a type-safe and purely functional solution, it leverages ZIO's features.
- **Multi-Platform** - It supports both JVM and JS platforms.
- **Multi-Platform** - It supports JS, JVM and Native platforms for the core zio-logging module, all other modules are only available for JVM.
- **Composable** — Loggers are composable together via contraMap.
- **Pluggable Backends** — Support multiple backends like ZIO Console, SLF4j, JPL.
- **Logger Context** — It has a first citizen _Logger Context_ implemented on top of `FiberRef`. The Logger Context maintains information like logger name, filters, correlation id, and so forth across different fibers. It supports _Mapped Diagnostic Context (MDC)_ which manages contextual information across fibers in a concurrent environment.
@@ -28,7 +28,7 @@ In order to use this library, we need to add the following line in our `build.sb

```scala
// ZIO Logging backends
libraryDependencies += "dev.zio" %% "zio-logging" % "2.3.2"
libraryDependencies += "dev.zio" %% "zio-logging" % "2.4.0"
```

The main module contains the following features:
@@ -43,10 +43,10 @@ Other modules:

```scala
// SLF4j v1 integration
libraryDependencies += "dev.zio" %% "zio-logging-slf4j" % "2.3.2"
libraryDependencies += "dev.zio" %% "zio-logging-slf4j" % "2.4.0"

// SLF4j v2 integration
libraryDependencies += "dev.zio" %% "zio-logging-slf4j2" % "2.3.2"
libraryDependencies += "dev.zio" %% "zio-logging-slf4j2" % "2.4.0"
```
When to use this module: you are already using SLF4J logger in some other project, and you like to have same log outputs.
See SLF4J [v2](docs/slf4j2.md) or [v1](docs/slf4j1.md) section for more details.
@@ -56,10 +56,10 @@ Other modules:

```scala
// Using ZIO Logging for SLF4j v1 loggers, usually third-party non-ZIO libraries
libraryDependencies += "dev.zio" %% "zio-logging-slf4j-bridge" % "2.3.2"
libraryDependencies += "dev.zio" %% "zio-logging-slf4j-bridge" % "2.4.0"

// Using ZIO Logging for SLF4j v2 loggers, usually third-party non-ZIO libraries
libraryDependencies += "dev.zio" %% "zio-logging-slf4j2-bridge" % "2.3.2"
libraryDependencies += "dev.zio" %% "zio-logging-slf4j2-bridge" % "2.4.0"
```

When to use this module: you want to use some zio-logger implementation, but also you are using some java library which using SLF4J interface for logging.
@@ -70,7 +70,7 @@ Other modules:

```scala
// JPL integration
libraryDependencies += "dev.zio" %% "zio-logging-jpl" % "2.3.2"
libraryDependencies += "dev.zio" %% "zio-logging-jpl" % "2.4.0"
```

When to use this module: you are already using Java Platform/System Logger in some other project, and you like to have same log outputs.
@@ -81,7 +81,7 @@ Other modules:

```scala
// JUL bridge
libraryDependencies += "dev.zio" %% "zio-logging-jul-bridge" % "2.3.2"
libraryDependencies += "dev.zio" %% "zio-logging-jul-bridge" % "2.4.0"
```

When to use this module: you are already using JUL logger in some other project, and you like to have same log outputs.
43 changes: 32 additions & 11 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -16,6 +16,7 @@ inThisBuild(
List(
name := "zio-logging",
ciEnabledBranches := Seq("master"),
// ciJvmOptions ++= Seq("-Xmx6g", "-Xss2m", "-XX:+UseG1GC"),
ciTestJobs := ciTestJobs.value.map(ciJobWithSetup) :+ compileExamplesJob.value,
ciLintJobs := ciLintJobs.value.map(ciJobWithSetup),
ciBuildJobs := ciBuildJobs.value.map(ciJobWithSetup),
@@ -32,8 +33,8 @@ inThisBuild(
),
Developer("justcoon", "Peter Kotula", "peto.kotula@yahoo.com", url("https://github.com/justcoon"))
),
zioVersion := "2.1.12",
scala213 := "2.13.15"
zioVersion := "2.1.15",
scala213 := "2.13.16"
)
)

@@ -50,14 +51,17 @@ lazy val root = project
.aggregate(
coreJVM,
coreJS,
coreNative,
slf4j,
slf4j2,
slf4jBridge,
slf4j2Bridge,
jpl,
julBridge,
benchmarks,
examplesCore,
examplesCoreJVM,
examplesCoreJS,
examplesCoreNative,
examplesJpl,
examplesJulBridge,
examplesSlf4j2Bridge,
@@ -67,7 +71,7 @@ lazy val root = project
docs
)

lazy val core = crossProject(JSPlatform, JVMPlatform)
lazy val core = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Full)
.in(file("core"))
.settings(stdSettings(Some("zio-logging"), turnCompilerWarningIntoErrors = false))
@@ -84,9 +88,16 @@ lazy val core = crossProject(JSPlatform, JVMPlatform)
mimaSettings(failOnProblem = true)
)

lazy val coreJVM = core.jvm
lazy val coreJS = core.js.settings(
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion % Test
lazy val coreJVM = core.jvm
lazy val coreJS = core.js.settings(
libraryDependencies ++= Seq(
"io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion,
"io.github.cquiroz" %%% "scala-java-time-tzdb" % scalaJavaTimeVersion,
("org.scala-js" %%% "scalajs-java-securerandom" % "1.0.0" % Test).cross(CrossVersion.for3Use2_13)
)
)
lazy val coreNative = core.native.settings(
libraryDependencies += "io.github.cquiroz" %%% "scala-java-time" % scalaJavaTimeVersion
)

lazy val slf4j = project
@@ -180,19 +191,29 @@ lazy val benchmarks = project
.dependsOn(coreJVM)
.enablePlugins(JmhPlugin)

lazy val examplesCore = project
lazy val examplesCore = crossProject(JSPlatform, JVMPlatform, NativePlatform)
.crossType(CrossType.Full)
.in(file("examples/core"))
.dependsOn(coreJVM)
.dependsOn(core % "compile->compile;test->test")
.settings(stdSettings(Some("zio-logging-examples-core"), turnCompilerWarningIntoErrors = false))
.settings(enableZIO())
.settings(
publish / skip := true,
publish / skip := true
)

lazy val examplesCoreJVM = examplesCore.jvm
.settings(
libraryDependencies ++= Seq(
"dev.zio" %% "zio-metrics-connectors-prometheus" % zioMetricsConnectorsVersion,
"dev.zio" %% "zio-http" % zioHttp,
"dev.zio" %% "zio-config-typesafe" % zioConfig
)
)
lazy val examplesCoreJS = examplesCore.js
.settings(
scalaJSUseMainModuleInitializer := true
)
lazy val examplesCoreNative = examplesCore.native

lazy val examplesSlf4jLogback = project
.in(file("examples/slf4j-logback"))
@@ -280,7 +301,7 @@ lazy val compileExamplesJob = Def.setting {
SingleStep(
name = "Compile additional subprojects",
run = Some(
"sbt ++${{ matrix.scala }} examplesCore/compile examplesJpl/compile examplesJulBridge/compile " +
"sbt ++${{ matrix.scala }} examplesCoreJVM/compile examplesCoreJS/compile examplesCoreNative/compile examplesJpl/compile examplesJulBridge/compile " +
"examplesSlf4j2Bridge/compile examplesSlf4jLogback/compile examplesSlf4j2Logback/compile " +
"examplesSlf4j2Log4j/compile benchmarks/compile"
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* Copyright 2019-2024 John A. De Goes and the ZIO Contributors
*
* 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 zio.logging

private[logging] trait LoggingPackagePlatformSpecific
Loading