Skip to content
CAI
Software that uses CAICheck a score

typelevel/log4cats

63.3

Adequate · 6 November 2026

3.7k

lines of production code

Scala

primary language

4

measurements over time

CAI band scale
CAI trend line
CAI lens gauges

What this system is

Features

Add Scala 2 macro for automatic logger name derivation

Introduced a Scala 2-specific compatibility layer that automatically derives the logger name from the enclosing class or module at compile time. This is implemented via a new \LoggerNameCompat\ trait and the \LoggerNameMacro\ implementation, which resolves the enclosing symbol and generates the appropriate \LoggerName\ instance, handling edge cases such as package objects, inner classes, and higher-kinded types to ensure correct naming behavior for Scala 2 users.

core/shared/src/main/scala-2, core/shared/src/main/scala-3 · high confidence

Add Scala.js console logging support

Introduces a new \js-console\ module that enables logging to the browser's Web Console in Scala.js applications. This includes a \ConsoleLogger\ implementation that maps log levels to browser console methods (info, warn, error, debug), a \ConsoleLoggerFactory\ for creating instances, and internal facade classes (\Console\, \ConsoleF\) to interact with the JavaScript environment via \cats-effect-kernel\.

js-console · high confidence

Add string interpolation syntax for Logger methods

Users can now use string interpolation syntax (e.g., logger"message") to log messages at various levels (error, warn, info, debug, trace) via the new LoggerInterpolator implicit class in the syntax package.

core/shared/src/main/scala/org/typelevel/log4cats/syntax · high confidence

Added Scala 2 compatibility layer for SLF4J logger creation

Introduced a new compatibility package for Scala 2 that provides macro-based implementations for creating SLF4J loggers. This includes \Slf4jLoggerCompat\ and \GetLoggerMacros\, which enable the \getLogger\ and \create\ methods to function correctly on Scala 2 by generating the appropriate logger instances via compile-time macros, ensuring binary compatibility and correct behavior for users on this platform.

slf4j/src/main/scala-2 · high confidence

New deferred and Writer-based logger implementations in log4cats extras

The \org.typelevel.log4cats.extras\ package now includes \DeferredLogger\, \DeferredStructuredLogger\, \DeferredSelfAwareStructuredLogger\, and \DeferredLoggerFactory\, which buffer log messages in memory and only emit them when explicitly triggered or when a resource scope fails or is cancelled—making them safer for scenarios like failure-only logging. Additionally, \WriterLogger\, \WriterStructuredLogger\, \WriterTLogger\, and \WriterTStructuredLogger\ provide logger implementations backed by \cats.data.Writer\ and \WriterT\, allowing logs to be accumulated alongside computation results, with a README documenting important caveats about their lifecycle and error-handling behavior.

core/shared/src/main/scala/org/typelevel/log4cats/extras · high confidence

New testing and extras utilities for structured logging

This change introduces new utilities in the \testing\ and \extras\ modules to support structured logging and easier testing. It adds \LogLevel\, \LogMessage\, and \StructuredLogMessage\ types to the \extras\ package, providing a standardized way to represent log levels and messages, including context maps for structured logging. Additionally, it provides \TestingLogger\, \StructuredTestingLogger\, and \TestingLoggerFactory\ in the \testing\ module, allowing developers to capture and inspect log messages during tests, with support for both standard and structured logging contexts.

repository · high confidence

Removals

Removal of placeholder Main entry point

The default application entry point (Main.scala) has been removed from the project. This eliminates the initial placeholder code that simply printed a startup message, indicating the project is moving past its initial scaffolding phase.

src/main · high confidence

Behavioural changes

Introduce structured logging traits and paging support

The core logging API has been refactored to support structured logging and message pagination. New traits—MessageLogger, ErrorLogger, StructuredLogger, SelfAwareLogger, and SelfAwareStructuredLogger—provide granular control over log levels and context injection via methods like addContext and withModifiedString. The LoggerFactory now exposes mapK, addContext, and withModifiedString to transform logger instances. Additionally, PagingSelfAwareStructuredLogger allows wrapping loggers to split large messages into paginated chunks, preventing truncation by underlying logging providers, with the previous withPaging method deprecated in favor of paged.

core/shared/src/main/scala/org/typelevel/log4cats · high confidence

NoOpLogger implementation moved to core module

The \NoOpLogger\ and \NoOpFactory\ implementations have been relocated to the \core/shared\ module. This change reorganizes the internal structure of the library, making the no-operation logger components part of the core shared codebase rather than a separate or peripheral location, without altering their functionality.

core/shared/src/main/scala/org/typelevel/log4cats/noop · high confidence

Ported SLF4J logger creation macros to Scala 3

The SLF4J logger creation logic has been migrated to Scala 3 using the new \scala.quoted\ macro system. This change introduces \Slf4jLoggerCompat\ and \GetLoggerMacros\ to handle the generation of \SelfAwareStructuredLogger\ instances, ensuring binary compatibility while updating the underlying implementation to use Scala 3's quote-based metaprogramming instead of the previous Scala 2 macros.

slf4j/src/main/scala-3 · high confidence

Refactor SLF4J logger creation with explicit factory pattern

The SLF4J integration now uses a new \Slf4jFactory\ trait and companion object to manage logger creation, replacing the previous implicit resolution mechanism. Users should now explicitly call \Slf4jFactory.create\[F\]\ to obtain a factory instance, as the previous implicit \loggerFactoryforSync\ has been deprecated. The \Slf4jLogger\ object provides updated methods like \getLoggerFromBlockingSlf4j\ and \fromBlockingSlf4j\ to support non-blocking logger instantiation, ensuring that creating logger instances does not block the calling thread.

slf4j/src/main/scala/org/typelevel/log4cats/slf4j · high confidence

Refactored internal SLF4J logger to handle MDC safely and non-blockingly

The internal \Slf4jLoggerInternal\ implementation has been rewritten to ensure that interactions with the SLF4J MDC (Mapped Diagnostic Context) are non-blocking and resilient to misconfiguration. The new code uses \Sync.delay\ to wrap MDC operations, preventing potential deadlocks in effectful contexts, and includes error handling to salvage logging output even if the MDC adapter is missing or throws an \IllegalStateException\. Additionally, the logger now exposes MDC state checks via \isEnabled\ methods and ensures that context is managed without blocking the calling thread.

slf4j/src/main/scala/org/typelevel/log4cats/slf4j/internal · high confidence

Switch to Apache 2.0 license and update build configuration

The project license has been changed to Apache 2.0. The build environment is now configured with specific JVM options in \.sbtopts\ (including G1GC and memory settings), and the Scala Steward configuration pins \slf4j-api\ and \logback-classic\ to version 1.x to prevent unwanted updates. Additionally, the \.scalafmt.conf\ file has been updated to version 3.11.5 with Scala 3 dialect support, and the Travis CI configuration has been removed.

(repo-wide) · high confidence

Test coverage

Added MUnit-based tests for paging structured logger; Added compilation hygiene and macro tests for Slf4jLogger; Added comprehensive tests for Slf4jLoggerInternal MDC handling and lazy evaluation; Added syntax compilation tests for LoggerFactory and Logger; Added tests for LoggerName resolution; Added tests for deferred logging capabilities; Removed obsolete MainSpec test.

Dependencies

Major dependency and build system overhaul

The project has been significantly modernized by upgrading core dependencies to Cats 2.13.0 and Cats-Effect 3.7.1, and updating the Scala versions to 2.12.21, 2.13.18, and 3.3.7. The build infrastructure has migrated to the sbt-typelevel plugin, replacing the previous release and CI setup, and the project structure has been split into distinct modules (core, testing, noop, slf4j, docs, js-console) with cross-compilation support for JVM, JS, and Native platforms.

(dependencies) · high confidence

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

How this codebase got here

Score

  • CAI 63 → 63 (-0.2)
  • Rubric changed (rubric-2026.10.5 → rubric-2026.11.2) — scores are not directly comparable.

Lenses

  • Code Health 74 → 74 (+0.0)
  • Architecture 99 → 99 (+0.0)
  • Maturity 49 → 54 (+5.3)
  • Readiness 74 → 74 (+0.0)
  • Security 79 → 65 (-13.9)

Resolved (1)

  • Off-boarding risk: anonymized user #1

New (1)

  • Off-boarding risk: anonymized user #1

Changes since last survey

  • 2 commits — 2 feature/other, 0 fixes

By area

  • (repo) — 1 commit
  • project/build.properties — 1 commit

Notable commits

  • change: Merge pull request #1002 from typelevel/update/sbt-1.13.1
  • change: Update sbt, scripted-plugin to 1.13.1

Architecture

  • Unchanged — 0 containers · 1 contexts · 0 edges

Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.

Survey your own repository

typelevel/log4cats was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.

About this page

  • The score is its most recent published measurement, taken on 6 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
  • Measured at commit d3e6d79df146cfe498f2c155af1992bd098b0007 — the exact code this score is about.
  • Scored under rubric-2026.11.2 — the same rubric and the same method as every other entry in this index.
  • Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.3+preprod-60d1b390edf0.