{"id":30296996,"url":"https://github.com/gokulnair2001/oslogkit","last_synced_at":"2025-08-17T03:04:35.244Z","repository":{"id":218361061,"uuid":"654648130","full_name":"gokulnair2001/OSLogKit","owner":"gokulnair2001","description":"A Layer 2 framework for OSLog which makes its adoption more easier⌨️","archived":false,"fork":false,"pushed_at":"2024-02-27T10:12:36.000Z","size":2213,"stargazers_count":23,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-17T03:04:02.304Z","etag":null,"topics":["ios","logger","loggers","macos","oslog","swift","swiftui","visionos"],"latest_commit_sha":null,"homepage":"https://oslogkit.vercel.app/documentation/oslogkit","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/gokulnair2001.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2023-06-16T15:42:57.000Z","updated_at":"2025-05-07T13:55:18.000Z","dependencies_parsed_at":null,"dependency_job_id":"bc0b7b2d-6ed7-44d4-8857-79a40df58a68","html_url":"https://github.com/gokulnair2001/OSLogKit","commit_stats":null,"previous_names":["gokulnair2001/oslogkit"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/gokulnair2001/OSLogKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gokulnair2001%2FOSLogKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gokulnair2001%2FOSLogKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gokulnair2001%2FOSLogKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gokulnair2001%2FOSLogKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gokulnair2001","download_url":"https://codeload.github.com/gokulnair2001/OSLogKit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gokulnair2001%2FOSLogKit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270800193,"owners_count":24648132,"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-08-17T02:00:09.016Z","response_time":129,"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":["ios","logger","loggers","macos","oslog","swift","swiftui","visionos"],"created_at":"2025-08-17T03:03:52.558Z","updated_at":"2025-08-17T03:04:35.229Z","avatar_url":"https://github.com/gokulnair2001.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n\u003c!-- \u003cimg src=\"https://github.com/gokulnair2001/OSLogKit/assets/56252259/55aef060-6273-4f48-8bed-f46ad6db8681\" width=20% height=20%\u003e --\u003e\n\n\u003cimg src=\"https://github.com/gokulnair2001/OSLogKit/assets/56252259/53164f76-9f0e-4dbf-8298-814424a427a0\" width=20% height=20%\u003e\n\n# OSLogKit\n\nOSLogKit is a layer 2 framework developed on top of the native OSLog system, aiming to simplify the integration of OSLog into your project. Apple has done an excellent job in ensuring that OSLogging is straightforward and easy to use. However, when it comes to implementing OSLog in your codebase, can be challenging. \n\nTo address this, OSLogKit has been developed, further simplifying the process of adopting OSLog. One notable advantage of OSLogKit is that it offers additional functionalities not available in the native API.\n\nOSLogKit has a variety of Modifiers which makes OSLogKit adoption very easy. Don't worry if your code base is in UIKit, you can still adopt it quickly.\n\n[![Generic badge](https://img.shields.io/badge/iOS-14.0+-black.svg)](https://shields.io/)\n[![Generic badge](https://img.shields.io/badge/macOS-11.0+-black.svg)](https://shields.io/)\n[![Generic badge](https://img.shields.io/badge/tvOS-14.0+-black.svg)](https://shields.io/)\n[![Generic badge](https://img.shields.io/badge/watchOS-7.0+-black.svg)](https://shields.io/)\n[![Generic badge](https://img.shields.io/badge/visionOS-1.0+-black.svg)](https://shields.io/)\n\n[Demo App](https://github.com/gokulnair2001/OSLogKit_DemoApp)\n\n## 📔 Usage \n\n### ⚙️ Initialisation\nIn order to use Logger you need to initialize the instance of Logger. OSLogKit supports a variety of Initialisation\n\n### 🗳 Basic Initialisation\n* The default behavior of the empty initialization is to store the logs in the subsystem that has the same name as the app's Bundle ID.\n* It is always suggested to use the default initializer, making it easy to manage Subsystems.\n```swift\nlet logger = Logger()\n```\n\n### 🗳 Advance Initialisation\n* This initialization provides the leverage to select your own Subsystem and Category\n* When Subsytem is left empty then the Bundle ID of the app is taken into consideration\n\n```swift\nlet logger = Logger(subSystem: \"com.gokulnair.Test-OSKit\", category: \"ContentView\")\n```\n## 🛠 Operations\nFollowing are the methods which OSLogKit supports\n\n💽 Single Capture/Logging\n* Captures a single log with specified OSLogLevel and message\n* By default the capture level is ```.default```\n```swift\n func capture(level: OSLogType? = nil, message: String)\n```\n\n💽 Bulk Capturing/Logging\n* Captures logs in bulk with the specified OSLogLevels and messages\n ```swift\n func captureInBulk(levels: [OSLogType] = [], messages: [String])\n ```\n \n 💽 Log Exporting\n * This method exports the log entries for a specific SubSystem within the specified time span\n * Use the same ```subsystem``` using which the logs are made\n * ```timeSpan``` denotes the span for which logs needs to be exported(Default 1 day)\n * ```completion``` Block returns an array of logs captured if the process succeeds and on failure, OSLogKit provides the error. \n * Exported Log format - `[[Date] [Category] message]`\n ```swift\n func exportLogs(forSubsystem subsystem: String = \"\", timeSpan span: OSLogSpan = .day(1), completion: @escaping((Result\u003c[String], OSLogError\u003e) -\u003e ()))\n ```\n \n ### OSLogSpan\n * OSLogSpan is the duration for which any log is exported\n Following are the OSLogSpans\n \n | Name | Cases | Description |\n | -- | -- | -- |\n | minutes | .minute(x) | Considers x minutes in past |\n | hours | .hour(x) | Considers x hours in past |\n | days | .day(x) | Considers x days in past |\n \n ### OSLogError\n * The default error type returned in OSLogKit for any form of failure is OSLogError\n * Use ```errorDescription``` in the failure case in order to get the error description\n * [Demo App](https://github.com/gokulnair2001/OSLogKit_DemoApp)\n \n | Name | Case | Description |\n | -- | -- | -- |\n | Export Failure | .exportFailure(let customString) | Custom export failure error |\n | Invalid Subsystem | .invalidSubsystem | Occurs when an Invalid Subsystem is used |\n \n ## SwiftUI Modifiers\n \n ### 🧩 CaptureLogOnAppear\n * ```logger``` log instance for which logs need to be captured\n * ```message``` string which needs to be logged\n * ```level``` specific level on which log needs to be captured\n * ```perform```Since this modifier is made on top of OnAppear in order to perform additional actions in OnAppear you can use this param\n ```swift\n func captureLogOnAppear(_ logger: OSLogKit, _ message: String, _ level: OSLogType = .default, _ perform: (() -\u003e Void)? = nil)\n ```\n \n ### 🧩 CaptureBulkLogOnAppear\n * ```logger``` log instance for which logs need to be captured\n * ```message``` strings that need to be logged\n * ```level``` specific levels on which logs need to be captured\n * ```perform```Since this modifier is made on top of OnAppear in order to perform additional actions in OnAppear you can use this param\n ```swift\n func captureBulkLogOnAppear(_ logger: OSLogKit, _ messages: [String], _ levels: [OSLogType], _ perform: (() -\u003e Void)? = nil)\n ```\n Other modifiers are\n \n | Case | Description |\n | -- | -- |\n | .captureLogOnDisappear | Captures log on disappear |\n | .captureBulkLogOnDisappear | Captures bulk log on disappear |\n | .captureLogOnLongPress | Captures log on long press |\n | .captureBulkLogOnLongPress | Captures bulk log on long press |\n | .captureLogOnTap | Captures log on tap |\n | .captureBulkLogOnTap | Captures bulk log on tap |\n | .captureLogOnSubmit | Captures log on submit |\n | .captureBulkLogOnSubmit | Captures bulk log on submit |\n \n * Parameters for the above modifiers are same as ```CaptureLogOnAppear``` \u0026 ```captureBulkLogOnAppear```\n\n## ⌨️ In Code Usage\n\n### SwiftUI\n```swift\n VStack {\n // Some view\n }.captureLogOnTap(logger, \"OSLogKit test log\") {\n  // additional on tap action (Optional)\n }\n```\n### UIKit\n```swift\nlogger.capture(message: \"OSLogKit test log\")\n```\n* The following are the most basic usage, various other parameters are available which can be used as per need\n\n## ⚠️ Caution\n* OSLogKit only supports messages of String type, thus in order to log messages with various privacy levels you still need to use the classic logger. This is because Apple doesn't provide the option to create an instance of OSLogMessage.\n* Thus create an instance of OSLogKit and directly access the classic logger.\n\n## 📦 SPM \nOSLogKit is available through [Swift Package Manager](https://github.com/apple/swift-package-manager/). To add OSLogKit through SPM\n* Open project in Xcode\n* **Select ```File \u003e Add Packages```**\n\n```\nhttps://github.com/gokulnair2001/OSLogKit\n```\n\u003cimg src=\"https://github.com/gokulnair2001/OSLogKit/assets/56252259/05f1688b-b62a-4114-a239-aa2f691f2e52\" width=80% height=40%\u003e\n\n## ✨ Upcoming Features\n* I am currently working on this version, aiming to delve deeper and offer a bunch of additional features. Keep an eye on my [Twitter](https://twitter.com/itIsGokulNair) handle for further updates.\n\n## ⚖️ License\n* OSLogKit is available under MIT [License](https://github.com/gokulnair2001/OSLogKit/blob/main/LICENSE).\n\n## 🪄 How to contribute?\n\n* Use the framework through SPM\n* If you face any issue or you feel you can contribute in any way then fork this repository, make your changes, and make a Pull Request\n\n\n\u003cp align=\"center\" width=\"100%\"\u003e\n   Made with ❤️ in 🇮🇳 By Gokul Nair   \n\u003c/p\u003e\n \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgokulnair2001%2Foslogkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgokulnair2001%2Foslogkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgokulnair2001%2Foslogkit/lists"}