{"id":21280305,"url":"https://github.com/harryjhin/slf4j-api-extensions","last_synced_at":"2026-01-26T02:31:47.733Z","repository":{"id":255616223,"uuid":"851510581","full_name":"HarryJhin/slf4j-api-extensions","owner":"HarryJhin","description":"slf4j-api-extensions is a GitHub project that provides additional utilities and enhancements for the SLF4J logging framework to improve its functionality and ease of use.","archived":false,"fork":false,"pushed_at":"2024-11-17T15:57:10.000Z","size":83,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-11-17T16:38:50.045Z","etag":null,"topics":["dokka","kotlin","library","slf4j","slf4j-api"],"latest_commit_sha":null,"homepage":"https://harryjhin.github.io/slf4j-api-extensions/","language":"Kotlin","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HarryJhin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-03T08:23:50.000Z","updated_at":"2024-11-17T15:44:27.000Z","dependencies_parsed_at":"2024-09-06T10:39:06.681Z","dependency_job_id":null,"html_url":"https://github.com/HarryJhin/slf4j-api-extensions","commit_stats":null,"previous_names":["harryjhin/slf4j-api-extensions"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryJhin%2Fslf4j-api-extensions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryJhin%2Fslf4j-api-extensions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryJhin%2Fslf4j-api-extensions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HarryJhin%2Fslf4j-api-extensions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HarryJhin","download_url":"https://codeload.github.com/HarryJhin/slf4j-api-extensions/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225711972,"owners_count":17512314,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dokka","kotlin","library","slf4j","slf4j-api"],"created_at":"2024-11-21T10:29:12.800Z","updated_at":"2026-01-26T02:31:47.727Z","avatar_url":"https://github.com/HarryJhin.png","language":"Kotlin","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build](https://github.com/HarryJhin/slf4j-api-extensions/actions/workflows/build.yml/badge.svg)](https://github.com/HarryJhin/slf4j-api-extensions/actions/workflows/build.yml)\n[![Deploy to GitHub Pages](https://github.com/HarryJhin/slf4j-api-extensions/actions/workflows/static.yml/badge.svg)](https://github.com/HarryJhin/slf4j-api-extensions/actions/workflows/static.yml)\n[![Publish to Sonatype](https://github.com/HarryJhin/slf4j-api-extensions/actions/workflows/publish.yml/badge.svg)](https://github.com/HarryJhin/slf4j-api-extensions/actions/workflows/publish.yml)\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.harryjhin/slf4j-api-extensions.svg?label=Maven%20Central)](https://central.sonatype.com/artifact/io.github.harryjhin/slf4j-api-extensions)\n[![Kotlin](https://img.shields.io/badge/kotlin-2.0.10-blue.svg?logo=kotlin)](http://kotlinlang.org)\n[![KDoc link](https://img.shields.io/badge/API_reference-KDoc-blue)](https://harryjhin.github.io/slf4j-api-extensions/)\n[![License](https://img.shields.io/github/license/HarryJhin/slf4j-api-extensions)](https://opensource.org/licenses/MIT)\n\n# Kotlin 사용자를 위한 SLF4J 확장 라이브러리\n\n`slf4j-api-extensions`는 Kotlin 사용자들에게 SLF4J(Simple Logging Facade for Java)를 더욱 편리하게 사용할 수 있도록 돕는 라이브러리입니다.\n\n## 주요 특징\n\n1. `slf4j-api` 확장: 구현체를 직접 사용하는 대신 `slf4j-api`를 확장하여 사용할 수 있는 기능을 제공합니다.\n   즉, `slf4j-simple`, `log4j2`, `logback` 등의 구현체를 사용하는 경우에 모두 동일한 API를 사용할 수 있습니다.\n2. 캐싱: `Logger` 인스턴스를 캐싱하여 불필요한 인스턴스 생성을 줄여줍니다.\n3. 함수형 패러다임: 함수형 프로그래밍 스타일로 로깅을 할 수 있도록 지원합니다.\n\n## dependency\n\n```kotlin\ndependencies {\n    implementation(\"io.github.harryjhin:slf4j-api-extensions:$version\")\n}\n```\n\n## 구성\n\n### Logger Cache\n\n`Logger` 인스턴스 생성은 비용이 비싸기 때문에, `Logger` 인스턴스를 캐싱하여 불필요한 인스턴스 생성을 줄여줍니다.\n단, 최대 1,000개의 `Logger` 인스턴스만 캐싱합니다.\n만약 캐싱된 `Logger` 인스턴스가 1,000개를 넘어가면, 가장 오래된 `Logger` 인스턴스를 제거합니다(FIFO).\n최대 캐싱 개수를 변경하려면 `slf4j-api-extensions.properties` 파일을 생성하고 `max-cache-size` 값을 변경하면 됩니다.\n\n`src/main/resources/slf4j-api-extensions.properties`:\n\n```properties\nmax-cache-size=100\n```\n\n## 사용법\n\n`slf4j-api-extensions`는 내부에서 활성화된 로그 레벨을 확인하고, 활성화되었을 때만 `message`를 생성합니다.\n여기서 `message`는 `() -\u003e String` 형태의 람다 함수입니다.\n이렇게 함으로써, 로그 레벨이 활성화되지 않은 경우에는 `message`를 생성하지 않음으로써 성능을 향상시킬 수 있습니다.\n\n### trace\n\n```kotlin\nclass MyClass {\n\n    fun myFunc() {\n        trace { \"trace message\" }\n    }\n\n    fun throwableFunc() {\n        val throwable = Throwable(\"throwable message\")\n        trace(throwable) { \"trace message\" }\n    }\n}\n```\n\n### debug\n\n```kotlin\nclass MyClass {\n\n    fun myFunc() {\n        debug { \"debug message\" }\n    }\n\n    fun throwableFunc() {\n        val throwable = Throwable(\"throwable message\")\n        debug(throwable) { \"debug message\" }\n    }\n}\n```\n\n### info\n\n```kotlin\nclass MyClass {\n\n    fun myFunc() {\n        info { \"info message\" }\n    }\n\n    fun throwableFunc() {\n        val throwable = Throwable(\"throwable message\")\n        info(throwable) { \"info message\" }\n    }\n}\n```\n\n### warn\n\n```kotlin\nclass MyClass {\n\n    fun myFunc() {\n        warn { \"warn message\" }\n    }\n\n    fun throwableFunc() {\n        val throwable = Throwable(\"throwable message\")\n        warn(throwable) { \"warn message\" }\n    }\n}\n```\n\n### error\n\n```kotlin\nclass MyClass {\n\n    fun myFunc() {\n        error { \"error message\" }\n    }\n\n    fun throwableFunc() {\n        val throwable = Throwable(\"throwable message\")\n        error(throwable) { \"error message\" }\n    }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryjhin%2Fslf4j-api-extensions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fharryjhin%2Fslf4j-api-extensions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fharryjhin%2Fslf4j-api-extensions/lists"}