{"id":18389312,"url":"https://github.com/rightpoint/rplogging","last_synced_at":"2025-04-12T05:22:11.880Z","repository":{"id":78961398,"uuid":"525169886","full_name":"Rightpoint/RPLogging","owner":"Rightpoint","description":"Log level settings for iOS, macOS, tvOS, \u0026 watchOS ","archived":false,"fork":false,"pushed_at":"2023-10-26T21:20:42.000Z","size":25,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-02-16T00:48:06.789Z","etag":null,"topics":[],"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/Rightpoint.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null},"funding":{"github":null,"patreon":null,"open_collective":null,"ko_fi":null,"tidelift":null,"community_bridge":null,"liberapay":null,"issuehunt":null,"otechie":null,"custom":["https://tippin.me/@cypher_poet","https://zbd.gg/Cypherpoet"]}},"created_at":"2022-08-15T23:35:48.000Z","updated_at":"2023-04-17T07:33:48.000Z","dependencies_parsed_at":null,"dependency_job_id":"e626f365-5769-43b7-a21f-967131393d14","html_url":"https://github.com/Rightpoint/RPLogging","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FRPLogging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FRPLogging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FRPLogging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Rightpoint%2FRPLogging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Rightpoint","download_url":"https://codeload.github.com/Rightpoint/RPLogging/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248520248,"owners_count":21117905,"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":[],"created_at":"2024-11-06T01:42:30.883Z","updated_at":"2025-04-12T05:22:11.851Z","avatar_url":"https://github.com/Rightpoint.png","language":"Swift","funding_links":["https://tippin.me/@cypher_poet","https://zbd.gg/Cypherpoet"],"categories":[],"sub_categories":[],"readme":"# Logging\n\nSet a logging level to dictate priority of events logged\n\n### Quick Start\n\nBy default, nothing will be logged, so you want to set a logging level during app set-up, before any loggable events. Different logging levels are often set for different build schemes (debug scheme may be `.verbose` while release might be `.warn`).\n```swift\nLog.logLevel = .warn\n```\n\nUse the level functions when logging to indicate what type of event has occurred\n```swift\nLog.verbose(\"Lower priority events will not be logged\")\nLog.error(\"Errors are higher priority than .warn, so will be logged\")\n```\n\nLog levels (from highest to lowest priority):\n- verbose\n- debug\n- info\n- warn\n- error\n- off\n\n\nA Trace is similar to a Log, but can be used to measure timing. Traces will also be logged as os_signposts which are viewable in Xcode Instruments.\n\n```swift\nTrace.begin(\"App Startup\")\n...\nTrace.end(\"App Startup\")\n\nTrace.event(\"App moved to background\")\n\n```\n\n\n## Advanced functionality\n\nOne or more LogHandlers may be added at both the instance level, or global level. A `LogHandler` may be used for example to send the log messages to the console, or to an analytics service. There is a `OSLogHandler` defined globally by default, which will send log output to the console or oslog if running iOS 14 or greater.\n\n```swift\npublic protocol LogHandler {\n    func handle(message: Log.Message)\n}\n\n// add a handler that will receive messages from ALL log instances.\nLog.addGlobalHandler(MyLogHandler())\n```\n\nLog messages may be categorized by defining separate instances of the Log class.\n\n```swift\nfinal class Loggers {\n    static let userInterface = Log(\"UI\", logLevel: .verbose)\n    static let app = Log(\"App\")\n    static let network = Log(\"Network\", logLevel: .error)\n}\n\nLoggers.userInterface.info(\"Button Pressed\")\nLoggers.network.error(\"Token Expired\")\nLoggers.app.warn(\"Out of Memory\")\n```\n\nYou may also include custom handlers per Log instance. Messages will still be reported to the global handler as well.\n\n```swift\nLoggers.network.addHandler(MyLogHandler())\n```\n\nLog level can also be represented by emoji instead of strings.\n\n```swift\nLog.useEmoji = true\n```\n\nEmoji key:\n- .verbose = 📖\n- .debug = 🐝\n- .info = ✏️\n- .warn = ⚠️\n- .error = ⁉️\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frightpoint%2Frplogging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frightpoint%2Frplogging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frightpoint%2Frplogging/lists"}