{"id":17147804,"url":"https://github.com/alexanderwe/loggingkit","last_synced_at":"2025-06-23T10:34:49.175Z","repository":{"id":55086173,"uuid":"258731275","full_name":"alexanderwe/LoggingKit","owner":"alexanderwe","description":"A micro framework for logging in Swift ","archived":false,"fork":false,"pushed_at":"2021-01-11T19:56:07.000Z","size":574,"stargazers_count":8,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-23T18:41:45.879Z","etag":null,"topics":["ios","macos","oslog","swift","tvos","watchos"],"latest_commit_sha":null,"homepage":"https://alexanderwe.github.io/LoggingKit","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/alexanderwe.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}},"created_at":"2020-04-25T09:17:14.000Z","updated_at":"2025-04-16T23:52:39.000Z","dependencies_parsed_at":"2022-08-14T11:31:18.654Z","dependency_job_id":null,"html_url":"https://github.com/alexanderwe/LoggingKit","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/alexanderwe/LoggingKit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexanderwe%2FLoggingKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexanderwe%2FLoggingKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexanderwe%2FLoggingKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexanderwe%2FLoggingKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexanderwe","download_url":"https://codeload.github.com/alexanderwe/LoggingKit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexanderwe%2FLoggingKit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261462685,"owners_count":23162012,"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":["ios","macos","oslog","swift","tvos","watchos"],"created_at":"2024-10-14T21:26:07.221Z","updated_at":"2025-06-23T10:34:44.158Z","avatar_url":"https://github.com/alexanderwe.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LoggingKit\n\n\u003cp align=\"center\"\u003e\n   \u003cimg width=\"750\" src=\"https://raw.githubusercontent.com/alexanderwe/LoggingKit/master/assets/loggingkit_logo.png\" alt=\"SwiftKit Header Logo\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n   \u003ca href=\"https://developer.apple.com/swift/\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/Swift-5.0-orange.svg?style=flat\" alt=\"Swift 5.0\"\u003e\n   \u003c/a\u003e\n   \u003ca href=\"https://github.com/apple/swift-package-manager\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg\" alt=\"SPM\"\u003e\n   \u003c/a\u003e\n\n   \u003ca href=\"https://github.com/alexanderwe/LoggingKit\"\u003e\n      \u003cimg src=\"https://github.com/alexanderwe/LoggingKit/workflows/CI/badge.svg\" alt=\"CI\"\u003e\n   \u003c/a\u003e   \n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\nLoggingKit is a micro framework for logging based on log providers \n\u003c/p\u003e\n\n## Features\n\n- [x] Define your own log providers\n- [x] `Combine` ready\n- [x] Comes with pre-defined `OSLogProvider` which uses `os_log` under the hood\n\n## Example\n\nThe example application is the best way to see `LoggingKit` in action. Simply open the `LoggingKit.xcodeproj` and run the `Example` scheme.\n\nAfter the application has started you should see several log messages in your Xcode terminal and the `Console.app` for the device you ran the app on.\n\n## Installation\n\n### Swift Package Manager\n\nTo integrate using Apple's [Swift Package Manager](https://swift.org/package-manager/), add the following as a dependency to your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/alexanderwe/LoggingKit.git\", from: \"2.0.0\")\n]\n```\n\nAlternatively navigate to your Xcode project, select `Swift Packages` and click the `+` icon to search for `LoggingKit`.\n\n### Manually\n\nIf you prefer not to use any of the aforementioned dependency managers, you can integrate LoggingKit into your project manually. Simply drag the `Sources` Folder into your Xcode project.\n\n## Usage\n\nAt first it makes sense to create an extensions on `LogCategories` to define your own categories.\n\n```swift\nimport LoggingKit\n\nextension LogCategories {\n    public var viewControllers: LogCategory { return .init(\"viewControllers\") }\n    public var networking: LogCategory { return .init(\"networking\") }\n    ...\n}\n```\n\nThen register your log providers in the `application(application:didFinishLaunchingWithOptions:)`.\n\n```swift\nimport LoggingKit\n\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n\n    ...\n\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions:[UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n\n        LogService.register(logProviders: LogProvider, LogProvider ...)\n\n    }\n\n    ...\n}\n```\n\nAfter that Simply import `LoggingKit` in the files you want to use the logging methods and use them accordingly\n\n```swift\nimport LoggingKit\n\nLogService.shared.debug(\"Hello Debug\", logCategory: \\.viewControllers)\nLogService.shared.verbose(\"Hello Verbose\", logCategory: \\.viewControllers)\nLogService.shared.info(\"Hello Info\", logCategory: \\.viewControllers)\nLogService.shared.warning(\"Hello Warning\", logCategory: \\.viewControllers)\nLogService.shared.error(\"Hello Error\", logCategory: \\.viewControllers)\n\n```\n\n### Combine\n\nIf you are using combine, `LoggingKit` offers some extensions on the `Publisher` type to log `Self.Output` and `Self.Failure`.\n\nYou can choose whichever category you want. The `\\.combine` category is a custom defined one.\n\n```swift\nimport LoggingKit\n\n// logs `Self.Output`\nmyPublisher.logValue(logType: .info, logCategory: \\.combine) {\n    \"My Value is \\($0)\"\n}\n\n// logs `Self.Failure`\nmyPublisher.logError(logCategory: \\.combine) {\n    \"My Error is \\($0)\"\n}\n\n// logs `Self.Output` as well as `Self.Failure`\nmyPublisher.log()\n```\n\n### Providers\n\nThe idea behind this small framework is, that you can extend it by writing your own log providers by conforming to the `LogProvider` protocol. These implementations then can be registered in the `LogService.register(providers:)` method.\n\nYou can find an example `LogProvider` implementation in [./Example/MyTestLogProvider.swift](./Example/MyTestLogProvider.swift)\n\n#### OSLogProvider\n\nLoggingKit comes with one pre-defined `OSLogProvider` . It uses `os_log` under the hood to log your messages. These messages can then be viewed in the `Console.app` application of your mac and on the console in Xcode.\n\n##### Console App\n\nOpen `Console.App` on your mac, select the device from which you want to view the log messages, to view the messages printed by the `OSLogProvider`\n\n![Console App Screenshot](./assets/console_screenshot.png)\n\n## Contributing\n\nContributions are very welcome 🙌\n\n## License\n\n```\nLoggingKit\nCopyright (c) 2020 Alexander Weiß\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexanderwe%2Floggingkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexanderwe%2Floggingkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexanderwe%2Floggingkit/lists"}