{"id":20604873,"url":"https://github.com/allaboutapps/logbook","last_synced_at":"2025-04-15T02:27:04.671Z","repository":{"id":36452754,"uuid":"222887860","full_name":"allaboutapps/Logbook","owner":"allaboutapps","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-04T10:31:21.000Z","size":77,"stargazers_count":8,"open_issues_count":2,"forks_count":0,"subscribers_count":8,"default_branch":"master","last_synced_at":"2025-03-28T14:11:40.041Z","etag":null,"topics":["id-allaboutapps-ios"],"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/allaboutapps.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":"2019-11-20T08:28:42.000Z","updated_at":"2023-07-04T08:24:26.000Z","dependencies_parsed_at":"2024-06-27T08:59:07.729Z","dependency_job_id":"8c1ed2a4-e746-4e0e-a2ca-733e75f4e692","html_url":"https://github.com/allaboutapps/Logbook","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allaboutapps%2FLogbook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allaboutapps%2FLogbook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allaboutapps%2FLogbook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/allaboutapps%2FLogbook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/allaboutapps","download_url":"https://codeload.github.com/allaboutapps/Logbook/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248993151,"owners_count":21195145,"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":["id-allaboutapps-ios"],"created_at":"2024-11-16T09:25:22.130Z","updated_at":"2025-04-15T02:27:04.638Z","avatar_url":"https://github.com/allaboutapps.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logbook\n\n[![SPM Compatible](https://img.shields.io/badge/SPM-compatible-4BC51D.svg?style=flat)](https://swift.org/package-manager/)\n[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\nLogbook is a lightweight logging framework for iOS and iPadOS\n\n## Features\n\n- [x] Levels: Debug -\u003e Error\n- [x] Categories\n- [x] Extendable Log Handler\n\n## Basic usage\n\nFirst setup `Logbook` by adding a LogSink\n\n```\nLogbook.add(sink: ConsoleLogSink())\n```\n\nLog some data\n\n```\nLogbook.debug(\"Hello Logbook\")\nLogbook.error(\"Hello Error\")\n```\n\n## Advanced usage\n\nCreate a global variable for faster access.\n\n```\nlet log = Logbook.self\n```\n\n```\nlog.debug(\"Hello Logbook\")\n```\n\n### LogSinks\n\nFilter logs by level.\n\n```\nConsoleLogSink(level: .min(.warning))\nConsoleLogSink(level: .fix(.info))\n```\n\nFilter logs by category:\n\n```\nConsoleLogSink(level: .min(.debug), categories: .include([.networking]))\n```\nor\n```\nConsoleLogSink(level: .min(.debug), categories: .exclude([.networking]))\n```\n\nAdd multiple sinks for different usecases:\n```\n// Log all with min level warning\nLogbook.add(sink: ConsoleLogSink(level: .min(.warning)))\n\n// Log only level error with category .networking\nLogbook.add(sink: ConsoleLogSink(level: .fix(.error), categories: .include([.networking])))\n```\n\n### Formatting\n\nAdd custom dateFormatter to sink\n\n```\nlet dateFormatter = DateFormatter()\ndateFormatter.dateStyle = .none\ndateFormatter.timeStyle = .short\n\nlet console = ConsoleLogSink(level: .min(.debug), categories: .exclude([.networking]))\nconsole.dateFormatter = dateFormatter\n```\n\nAdd logging format to ConsoleLogSink\n\n```\nconsole.format = \"\\(LogPlaceholder.category) \\(LogPlaceholder.date): \\(LogPlaceholder.messages)\"\n```\n\n### Custom LogSink\n\nCreate your custom sink by confirming LogSink protocol. \n\n\n### LogCategory\n\nExtend LogCategory to create custom categories.\n\n```\nextension LogCategory {\n    \n    static let startup = LogCategory(\"startup\", prefix: \"🚦\")\n    static let bluetooth = LogCategory(\"bluetooth\", prefix: \"🖲\")\n    \n}\n```\n\n```\nlog.debug(\"hello\", category: .startup)\n```\n\n\n## Carthage\n\nAdd the following line to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#cartfile).\n\n```\ngithub \"allaboutapps/Logbook\"\n```\n\nThen run `carthage update`.\n\n## Swift Package Manager\n\nUse Xcode 11+:\nGo to `Project \u003e Swift Packages \u003e +` and enter `https://github.com/allaboutapps/Logbook`\n\nOr update your Package.swift file manually:\n\n```swift\ndependencies: [\n.package(url: \"git@github.com:allaboutapps/Logbook.git\", from: \"1.1\"),\n    ....\n],\ntargets: [\n    .target(name: \"YourApp\", dependencies: [\"Logbook\"]),\n]\n```\n\n## Requirements\n\n- Swift 5+\n\n## Contributing\n\n* Create something awesome, make the code better, add some functionality,\n  whatever (this is the hardest part).\n* [Fork it](http://help.github.com/forking/)\n* Create new branch to make your changes\n* Commit all your changes to your branch\n* Submit a [pull request](http://help.github.com/pull-requests/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallaboutapps%2Flogbook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fallaboutapps%2Flogbook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fallaboutapps%2Flogbook/lists"}