{"id":24851920,"url":"https://github.com/dtroupe18/swiftdebuglog","last_synced_at":"2025-06-16T08:07:52.666Z","repository":{"id":62456480,"uuid":"171172065","full_name":"dtroupe18/SwiftDebugLog","owner":"dtroupe18","description":"Lightweight Swift Logging","archived":false,"fork":false,"pushed_at":"2019-03-25T20:26:03.000Z","size":16756,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-01-30T18:38:23.400Z","etag":null,"topics":["cocoapods","debug","ios","logging","open-source","swift","swift4"],"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/dtroupe18.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-02-17T21:01:53.000Z","updated_at":"2019-03-25T20:26:04.000Z","dependencies_parsed_at":"2022-11-02T00:16:55.195Z","dependency_job_id":null,"html_url":"https://github.com/dtroupe18/SwiftDebugLog","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/dtroupe18%2FSwiftDebugLog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtroupe18%2FSwiftDebugLog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtroupe18%2FSwiftDebugLog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dtroupe18%2FSwiftDebugLog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dtroupe18","download_url":"https://codeload.github.com/dtroupe18/SwiftDebugLog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245658982,"owners_count":20651520,"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":["cocoapods","debug","ios","logging","open-source","swift","swift4"],"created_at":"2025-01-31T14:27:31.187Z","updated_at":"2025-03-26T12:45:23.304Z","avatar_url":"https://github.com/dtroupe18.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SwiftDebugLog\n\n\n[![CI Status](https://img.shields.io/travis/Dtroupe18/SwiftDebugLog.svg?style=flat)](https://travis-ci.org/Dtroupe18/SwiftDebugLog)\n[![Version](https://img.shields.io/cocoapods/v/SwiftDebugLog.svg?style=flat)](https://cocoapods.org/pods/SwiftDebugLog)\n[![License](https://img.shields.io/cocoapods/l/SwiftDebugLog.svg?style=flat)](https://cocoapods.org/pods/SwiftDebugLog)\n[![Platform](https://img.shields.io/cocoapods/p/SwiftDebugLog.svg?style=flat)](https://cocoapods.org/pods/SwiftDebugLog)\n\nSimple Swift Debug Logger inspired by [this medium post](https://medium.com/@sauvik_dolui/developing-a-tiny-logger-in-swift-7221751628e6)\n\n\n## Purpose:\n\n1. Global wrapping of the print function. All print statements will be removed at compile time unless your code is compiled in    Debug. **Debug printing in production can be done using:** ```Log.logProduction(error)```\n\n2. Allows you to easily log errors that include the file name, line, and function name without additional typing. \n\n\n## Sample Output:\n\n2019-02-17 15:29:25.627-0500 🐛🐛🐛🐛 [ViewController.swift] line: 25 logInProduction() -\u003e This log always prints!\n\n2019-02-17 15:29:25.633-0500 😡 [ViewController.swift] line: 33 trySomething() -\u003e The item couldn’t be opened because the file name “” is invalid.\n\n2019-02-17 15:29:25.633-0500 🕵 [ViewController.swift] line: 43 makeApiCall() -\u003e [\"userId\": 1, \"id\": 1, \"title\": \"delectus aut autem\"]\n\n2019-02-17 15:29:25.634-0500 ⚠️ [ViewController.swift] line: 48 doSomethingWith(optional:) -\u003e Optional is nil!\n\n2019-02-17 15:29:25.634-0500 🚨🚨 [ViewController.swift] line: 55 doSomethingReallyImportant(shouldCrash:) -\u003e Crashing for some reason\n\n\n## Code to create the above logging:\n\n```swift\n    func logInProduction() {\n        // This should only be used when debugging in production!\n        Log.logProduction(\"This log always prints!\")\n    }\n\n    func trySomething() {\n        do {\n        // Something that might throw an error\n            let _ = try String(contentsOfFile: \"\")\n        } catch let error {\n            Log.logError(error.localizedDescription)\n        }\n    }\n\n    func makeApiCall() {\n        let json: [String: Any] = [\n            \"userId\": 1,\n            \"id\": 1,\n            \"title\": \"delectus aut autem\"\n        ]\n\n        Log.logDebug(json)\n    }\n\n    func doSomethingWith(optional: String?) {\n        guard let string = optional else {\n            Log.logWarning(\"Optional is nil!\")\n            return\n        }\n    }\n\n    func doSomethingReallyImportant(shouldCrash: Bool) {\n        if shouldCrash {\n            Log.logSevere(\"Crashing for some reason\")\n            fatalError()\n        }\n    }\n```\n\n\n## Logging Levels\n\n1. Error = 😡 \n2. Debug = 🕵\n3. Warning = ⚠️\n4. Severe = 🚨🚨\n5. Production = 🐛🐛🐛🐛\n\n\n## Example\n\nTo run the example project, clone the repo, and run `pod install` from the Example directory first.\n\n\n## Installation\n\nSwiftDebugLog is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```ruby\npod 'SwiftDebugLog'\n```\n\nor copy and paste [Log.swift](https://github.com/dtroupe18/SwiftDebugLog/blob/master/SwiftDebugLog/Classes/Log.swift) into your project! Using this method prevents you from having to `import SwiftDebugLog` in your files and it also globally wraps `print` into debug only.\n\n\n## License\n\nSwiftDebugLog is available under the MIT license. See the LICENSE file for more info.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtroupe18%2Fswiftdebuglog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdtroupe18%2Fswiftdebuglog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdtroupe18%2Fswiftdebuglog/lists"}