{"id":20495650,"url":"https://github.com/alexander-ignition/oslogging","last_synced_at":"2026-05-29T12:31:55.814Z","repository":{"id":63902018,"uuid":"216205281","full_name":"Alexander-Ignition/OSLogging","owner":"Alexander-Ignition","description":"swift-log + os.log","archived":false,"fork":false,"pushed_at":"2022-01-14T15:14:46.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-16T09:06:17.338Z","etag":null,"topics":["oslog","swift","swift-log","swift-logger"],"latest_commit_sha":null,"homepage":null,"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/Alexander-Ignition.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":"2019-10-19T12:48:25.000Z","updated_at":"2022-04-15T20:05:58.000Z","dependencies_parsed_at":"2023-01-14T13:00:57.372Z","dependency_job_id":null,"html_url":"https://github.com/Alexander-Ignition/OSLogging","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexander-Ignition%2FOSLogging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexander-Ignition%2FOSLogging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexander-Ignition%2FOSLogging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Alexander-Ignition%2FOSLogging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Alexander-Ignition","download_url":"https://codeload.github.com/Alexander-Ignition/OSLogging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":242077882,"owners_count":20068449,"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":["oslog","swift","swift-log","swift-logger"],"created_at":"2024-11-15T17:46:46.850Z","updated_at":"2026-05-29T12:31:55.807Z","avatar_url":"https://github.com/Alexander-Ignition.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# OSLogging\n\n[![SPM compatible](https://img.shields.io/badge/spm-compatible-brightgreen.svg?style=flat)](https://swift.org/package-manager)\n[![GitHub license](https://img.shields.io/badge/license-MIT-lightgrey.svg)](https://github.com/Alexander-Ignition/OSLogging/blob/master/LICENSE)\n\n[`OSLog`](https://developer.apple.com/documentation/os/logging) logging backend for [`swift-log`](https://github.com/apple/swift-log)\n\n- [WWDC 2016 Unified Logging and Activity Tracing](https://developer.apple.com/videos/play/wwdc2016/721/)\n- logs can be seen in Console.app\n\n## Features\n\n- [x] Configure `OSLog`\n- [x] Mapping logging levels of `Logger.Level` to `OSLogType`\n- [x] Customize metadata formatter\n\n## Instalation\n\nAdd dependency to `Package.swift`...\n\n```swift\n.package(url: \"https://github.com/Alexander-Ignition/OSLogging\", from: \"1.0.0\"),\n```\n\n... and your target\n\n```swift\n.target(name: \"ExampleApp\", dependencies: [\"OSLogging\"]),\n```\n\n## Usage\n\nOverride `LoggingSystem` with default `OSLog`.\n\n```swift\nLoggingSystem.bootstrap { _ in OSLogHandler() }\n\nlet logger = Logger(label: \"com.example.app\")\nlogger.info(\"i found you!\")\n// 2019-10-20 08:47:35.498086+0300 ExampleApp[6533:150683] i found you!\n```\n\nСhoose subsystems and categories for different parts of the application\n\n```swift\nlet logger = Logger(label: \"com.exaple.app\") { label in\n    OSLogHandler(subsystem: label, category: \"auth\")\n}\n\nlogger.info(\"loose control\")\n// 2019-10-20 08:47:35.498582+0300 ExampleApp[6533:150683] [auth] loose control\n```\n\nCustom metadata format\n\n```swift\nvar logger = Logger(label: \"com.exaple.app\") { label in\n    var hanlder = OSLogHandler(subsystem: label, category: \"session\")\n    hanlder.formatter = { metadata in\n        metadata.map { \"\\($0):\\($1)\" } .joined(separator: \", \")\n    }\n    return hanlder\n}\nlogger[metadataKey: \"request-id\"] = \"1\"\nlogger[metadataKey: \"session-id\"] = \"a\"\n\nlogger.warning(\"catch me if you can\")\n// 2019-10-20 08:47:35.499106+0300 ExampleApp[6533:150683] [session] session-id:a, request-id:1 catch me now\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexander-ignition%2Foslogging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexander-ignition%2Foslogging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexander-ignition%2Foslogging/lists"}