Skip to content

feat(logging): enhance logging system with context support, JSON fixes, performance improvements, and CI setup#1

Merged
shivathapaa merged 21 commits into
mainfrom
feat-add-context
Mar 31, 2026
Merged

feat(logging): enhance logging system with context support, JSON fixes, performance improvements, and CI setup#1
shivathapaa merged 21 commits into
mainfrom
feat-add-context

Conversation

@shivathapaa

Copy link
Copy Markdown
Owner

Description

This PR introduces comprehensive improvements to the logging system, including new features, bug fixes, refactoring, and CI enhancements. It focuses on improving performance, correctness, and developer experience across multiple platforms.

Features

  • Add log timestamp support
  • Support retrieving the current thread name (multi-platform)
  • Cache logger instances in LoggerFactory for improved performance

Fixes

  • Ensure valid JSON output, including proper handling of emoji
  • Fix premature evaluation of message() before level filtering
  • Correct timestamp handling in JsonLogFormatter

Refactoring and Improvements

  • Simplify LogLevel by removing explicit priority and using natural ordering
  • Remove unused formatMap methods from ConsoleSink and DefaultSink
  • Update LogContextHolder.withContext to return values correctly
  • Integrate Log API with LoggerFactory and improve documentation
  • Improve currentTimeMillis implementation for WasmJS
  • Update currentThreadName implementation for Apple targets
  • Remove redundant null checks and general cleanup

Tests

  • Add unit tests for core logging components and formatters
  • Add IntelliJ shared run configurations for Gradle tests

CI/CD and Tooling

  • Add GitHub Actions workflow for multi-platform testing
  • Update publish workflow to include automated tests and versioning
  • Add Dependabot configuration for dependency updates

Documentation

  • Update README for version 1.3.0
  • Migrate GitHub issue templates to YAML forms

Chore

  • Bump library version and update dependencies

…S thread safety

- Change block type from () -> Unit to () -> T to propagate return values
- Replace shared mutableListOf stack on Apple targets with NSThread
  threadDictionary for true per-thread isolation
- JVM/Android implementations unchanged (ThreadLocal already correct)
- JS/Wasm/Linux/Mingw use simple var save-restore (single-threaded targets)
- Bump the library version to 1.3.0.
- Update Kotlin to 2.3.20 and AGP to 9.0.1.
- Update Compose Multiplatform, Foundation, and AndroidX Activity Compose dependencies in the version catalog.
- Update library versioning to 1.3.0 in Gradle dependency examples.
- Update `Log.withClassTag()` usage to require a generic type.
- Redesign Log Levels table to include emojis and clarified severity descriptions.
- Revise "Available Sinks" section: rename `RemoteSink` to `RemoteLogSink` and provide more detailed configuration examples.
- Expand "Log Formatters" section with documentation for `Default`, `Compact`, `Pretty`, and `JSON` formatters.
- Update the comparison between Simple and Structured Logging APIs to reflect shared pipeline behavior and features like `TestSink` support and `LogContextHolder`.
- Refine various code samples and descriptions for clarity.
- Add unit tests for `DefaultLogger`, `LoggerFactory`, `LogPipeline`, and `LogPolicy`.
- Add verification tests for `DefaultLogFormatter` and `JsonLogFormatter`.
- Add tests for `LogContext`, `LogContextHolder`, and `LogLevel`.
- Implement `TestSink` for capturing and verifying log events in tests.
- Configure test runners for JVM, JS (Karma/Mocha), and WasmJS in `build.gradle.kts`.
- Add `kotlin-test` dependency to `commonTest`.
- Return "main" instead of "unknown" if the thread name is null or empty.
- Create `All Tests - All Platforms` run configuration to execute all library tests.
- Create `All Tests - Skip Browser` run configuration to execute tests while skipping JS and WasmJS browser targets.
- Update `.gitignore` to allow tracking of shared run configurations in the `.idea` directory.
@shivathapaa shivathapaa merged commit c214894 into main Mar 31, 2026
3 checks passed
@shivathapaa shivathapaa deleted the feat-add-context branch March 31, 2026 07:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant