{"id":32150744,"url":"https://github.com/23122k/swift-loggable","last_synced_at":"2026-02-17T21:38:23.349Z","repository":{"id":277066366,"uuid":"914011040","full_name":"23122K/swift-loggable","owner":"23122K","description":"Set of macros that support type-wide and per-function logging with ability to customize how logs are handled","archived":false,"fork":false,"pushed_at":"2025-09-08T12:33:50.000Z","size":872,"stargazers_count":15,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-24T12:03:01.862Z","etag":null,"topics":["logging","macros","swift","swift-macros"],"latest_commit_sha":null,"homepage":"","language":"Swift","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/23122K.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,"zenodo":null}},"created_at":"2025-01-08T19:21:26.000Z","updated_at":"2025-09-21T16:28:13.000Z","dependencies_parsed_at":"2025-03-02T18:30:25.500Z","dependency_job_id":"f7980c9e-9615-43e1-a244-e0cce57a27bf","html_url":"https://github.com/23122K/swift-loggable","commit_stats":null,"previous_names":["23122k/swift-loggable"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/23122K/swift-loggable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/23122K%2Fswift-loggable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/23122K%2Fswift-loggable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/23122K%2Fswift-loggable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/23122K%2Fswift-loggable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/23122K","download_url":"https://codeload.github.com/23122K/swift-loggable/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/23122K%2Fswift-loggable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280242080,"owners_count":26296906,"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","status":"online","status_checked_at":"2025-10-21T02:00:06.614Z","response_time":58,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["logging","macros","swift","swift-macros"],"created_at":"2025-10-21T10:19:33.974Z","updated_at":"2025-10-21T10:19:38.137Z","avatar_url":"https://github.com/23122K.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Loggable\n[![CI](https://github.com/23122K/swift-loggable/actions/workflows/ci.yaml/badge.svg?branch=main)](https://github.com/23122K/swift-loggable/actions/workflows/ci.yaml)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2F23122K%2Fswift-loggable%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/23122K/swift-loggable)\n[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2F23122K%2Fswift-loggable%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/23122K/swift-loggable)\n\nA set of macros that support type-wide and per-function logging with ability to customize how logs are handled.\n\n## Overview\nThere are many situations where logging additional information is helpful. However most of them are neglected as they reqire some boilerplate, this is especially present in bidirectional architectures. Loggable aims to simplify this  by providing macros that can:\n\n* **Annotate all methods within type or extension**\n\nThere is no need to annotate each method individually - simply apply the desired annotation to the declaration, and let the magic happen. Standalone functions can also be annotated.\n\n* **Customize how logs are handled**\n\nAll macros include the ability to add tags to logged functions, suppress their output or parameters, or ecent exclude the functions entirely from emmiting an event.\n\n* **Leverage OSLog support**\n\nLoggable provides macros that leverage Apple's OSLog framework, eliminating the need to manually create a [`Logger`](https://developer.apple.com/documentation/os/logger) instance, configure subsystems and categories, or log each function individually.\n\n\n**On top of that**, Loggable does not bind you into any proprietary logging system - use the logger of you choice without compromising on convinence that comes with macros.\n\n## Get started\n\nYou can start using Loggable in just two simple steps:\n\n1. Import Loggable package and enable macros.\n```swift\nimport Loggable\n```\n\n2. Mark desired type with `@Logged` annotation, eg.:\n```swift\nimport Loggable\nimport SwiftData\n\n@Logged\n@ModelActor\nactor SwiftDataClient {\n  func save\u003cT: PersistentModel\u003e(_ model: T) throws {\n    self.modelContext.insert(model)\n    try self.modelContext.save()\n  }\n}\n```\n\nThat's it! Now, whenever the `save` method is invoked, an event is emitted that captures metadata such as the location, signature, parameters, and result. For a more detailed guide, refer to the [documentation](https://swiftpackageindex.com/23122K/swift-loggable/main/documentation/loggable).\n\nAlternatively, you can take advantage of the OSLog framework by switching to the following approach:\n\n```swift\nimport Loggable\nimport SwiftData\n\n@OSLogger\n@OSLogged\n@ModelActor\nactor SwiftDataClient {\n  func save\u003cT: PersistentModel\u003e(_ model: T) throws {\n    self.modelContext.insert(model)\n    try self.modelContext.save()\n  }\n}\n```\nThe `@OSLogger` annotation introduces a static instance of [`Logger`](https://developer.apple.com/documentation/os/logger) , while `@OSLogged` implicitly makes every method within the annotated scope loggable. Refer to the [documentation](https://swiftpackageindex.com/23122K/swift-loggable/main/documentation/loggable) to learn more.\n\n## Learn More\nLoggable offers a wide range of additional features. You can create custom loggers, add tags to captured events for later processing, exclude specific methods from logging, ignore certain parameters (or all of them) from being captured, override the log level for individual events, and much more. For usage examples and detailed information, see the [documentation](https://swiftpackageindex.com/23122K/swift-loggable/main/documentation/loggable) or check example app [Count Me In](https://github.com/23122K/swift-loggable/tree/main/Examples/CountMeIn).\n\n## Installation\nAdd the following dependency to your Package.swift\n```swift\n.package(url: \"https://github.com/23122K/swift-loggable.git\", branch: \"main\"),\n```\nAlternatively, *Project → Package dependencies → + → Search or enter package URL* and paste \n```\nhttps://github.com/23122K/swift-loggable.git\n```\nIn both cases, choose dependency rule of your choice.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F23122k%2Fswift-loggable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F23122k%2Fswift-loggable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F23122k%2Fswift-loggable/lists"}