{"id":1359,"url":"https://github.com/tonystone/tracelog","last_synced_at":"2025-04-09T23:24:25.190Z","repository":{"id":1912166,"uuid":"45314462","full_name":"tonystone/tracelog","owner":"tonystone","description":"TraceLog is a highly configurable, flexible, portable, and simple to use debug logging system for Swift and Objective-C applications running on Linux, macOS, iOS, watchOS, and tvOS.","archived":false,"fork":false,"pushed_at":"2023-07-11T19:00:30.000Z","size":2536,"stargazers_count":54,"open_issues_count":3,"forks_count":15,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-03-24T01:13:22.444Z","etag":null,"topics":["cocoapods","debug","ios","linux","log-statements","logging","logging-library","macos","osx","swift","swift-3","swift-package-manager","swift3","swiftpm","trace","trace-level","tracelog","tvos","watchos"],"latest_commit_sha":null,"homepage":"https://tonystone.io/tracelog","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tonystone.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/Supporting Types.html","governance":null,"roadmap":null,"authors":null}},"created_at":"2015-10-31T19:03:52.000Z","updated_at":"2025-01-16T00:12:30.000Z","dependencies_parsed_at":"2024-01-02T21:09:17.075Z","dependency_job_id":null,"html_url":"https://github.com/tonystone/tracelog","commit_stats":{"total_commits":409,"total_committers":9,"mean_commits":45.44444444444444,"dds":0.05378973105134477,"last_synced_commit":"0e7a5d7bead7ef1e6fb71f19ab761aeba17888fb"},"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonystone%2Ftracelog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonystone%2Ftracelog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonystone%2Ftracelog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tonystone%2Ftracelog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tonystone","download_url":"https://codeload.github.com/tonystone/tracelog/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247744282,"owners_count":20988781,"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","linux","log-statements","logging","logging-library","macos","osx","swift","swift-3","swift-package-manager","swift3","swiftpm","trace","trace-level","tracelog","tvos","watchos"],"created_at":"2024-01-05T20:15:44.644Z","updated_at":"2025-04-09T23:24:25.158Z","avatar_url":"https://github.com/tonystone.png","language":"Swift","funding_links":[],"categories":["Logging","Libs","Logging [🔝](#readme)","The Index"],"sub_categories":["Other Hardware","Logging","Graphics"],"readme":"\u003cp align=\"center\"\u003ePlease \u003ca href=\"https://github.com/tonystone/tracelog/stargazers\"\u003estar\u003c/a\u003e this github repository to stay up to date.\u003c/p\u003e\n\n# TraceLog ![license: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-lightgray.svg?style=flat)\n\n\u003ca href=\"https://github.com/tonystone/tracelog/\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/platforms-iOS%20%7C%20macOS%20%7C%20watchOS%20%7C%20tvOS%20%7C%20Linux%20-lightgray.svg?style=flat\" alt=\"Platforms: iOS | macOS | watchOS | tvOS | Linux\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/tonystone/tracelog/\" target=\"_blank\"\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=\"http://cocoadocs.org/docsets/TraceLog\" target=\"_blank\"\u003e\n   \u003cimg src=\"https://img.shields.io/cocoapods/v/TraceLog.svg?style=flat\" alt=\"Version\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://travis-ci.org/tonystone/tracelog\" target=\"_blank\"\u003e\n   \u003cimg src=\"https://travis-ci.org/tonystone/tracelog.svg?branch=master\" alt=\"Build Status\"/\u003e\n\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/tonystone/tracelog\"\u003e\n  \u003cimg src=\"https://codecov.io/gh/tonystone/tracelog/branch/master/graph/badge.svg\" alt=\"Codecov\" /\u003e\n\u003c/a\u003e\n\n## Introduction\n\n**TraceLog** is a highly configurable, flexible, portable, and simple to use debug logging system for Swift and Objective-C applications running on Linux, macOS, iOS, watchOS, and tvOS.\n\n### TraceLog Design Philosophy\n1. **Universal**: With TraceLog you are not locked into one type of logging system, as a matter of fact, you can choose to use a combination of log writers to write to various endpoints and systems.\n2. **Flexible**: With TraceLog you can filter messages dynamically at run time or statically at compile time.  Choose whatever combination of `Writers` and filters that work for your particular use case. Write your own custom `Writer`s to plug into TraceLog for customized use-cases.\n3. **Portable**: At this writing, TraceLog is one of the few logging systems that was designed to run on all swift supported platforms (Linux, macOs, iOS, tvOS, and watchOS) and be used in multiple languages (Swift and Objective-C).\n4. **Lightweight**: TraceLog's footprint is small and efficient.  It's designed and meant to be as efficient on resources as can be and also optimize itself out if required by the use case.\n5. **Easy to use**: TraceLog can be used right out of the box with **No** setup or special dependencies.  That was designed in, and we've worked hard to maintain that over the years.  You can literally link to it and start adding `log` statements to your app and get useful output on any platform.\n\n### Features\n\n - [x] Quick and easy to get started.\n - [x] Fully configurable.\n - [x] Message filtering.\n - [x] **Logging Levels** (error, warning, info, trace1, trace2, trace3, trace4).\n - [x] Custom **tag** support for message grouping and filtering.\n - [x] Dynamically configurable levels via the OS environment at run time or inline code compiled into the application.\n - [x] Installable log writers (multiple writers at a time)\n - [x] Create custom log writers for any use-case.\n - [x] Predefined log writers to write to various endpoints.\n    * Built-in (`OutputStreamWriter`s)\n        * **Stdout (ConsoleWriter)** - A simple standard out (stdout) writer for logging to the console or terminal.\n        * **File (FileWriter)** - A file writer which writes log output to files on local disk managing rotation and archive of files as needed.\n    * External\n        * **Apple Unified Logging (AdaptiveWriter)** - On Apple platforms the AdaptiveWriter writes to the Unified Logging System (see [https://github.com/tonystone/tracelog-adaptive-writer](https://github.com/tonystone/tracelog-adaptive-writer)).\n        * **Linux systemd Journal (AdaptiveWriter)** - On Linux platforms the AdaptiveWriter writes to the systemd journal (see [https://github.com/tonystone/tracelog-adaptive-writer](https://github.com/tonystone/tracelog-adaptive-writer))\n - [x] Output formatters for formatting the log entries in any format required.\n    * **TextFormat** a customizable human readable text formatter useable with any `OutputStreamWriter`.\n    * **JSONFormat** a customizable JSON string formatter usable with any `OutputStreamWriter`.\n - [x] Create custom output formatters for any use case.\n - [x] An output buffering mode to buffer output when a writer is unavailable (e.g. on iOS when protected data is not available).\n - [x] Multiple **concurrency modes** for writing to Writers. Settable globally or per Writer installed.\n   * **direct** - straight through real-time logging.\n   * **sync** - blocking queued logging.\n   * **async** - background thread logging.\n- [x] **Multi-language**: Swift and Objective-C support.\n- [x] **Portable**: Linux, macOS, iOS, tvOS, WatchOS\n\n## Documentation\n\n* [User Guides \u0026 Reference](https://tonystone.io/tracelog) - Extensive user guides and reference documentation!  100% documented API, full examples and many hidden details.\n\n## Quick Start Guide\n\nUsing TraceLog is incredibly simple out of the box.  Although TraceLog is highly configurable, to get started all you have to do is add the pod to your project,\nimport TraceLog to the files that require logging and start adding log statements where you need them.  TraceLog initializes itself and does everything else for you.\n\n### Add TraceLog to your project\n\nIn your `Podfile` add TraceLog.\n\n```ruby\n    target 'MyApp'\n\n    pod \"TraceLog\", '~\u003e5.0'\n```\nIf you have mixed Swift and Objective-C code, you must specify the subspec to enable Objective-C as follows:\n\n```ruby\n    target 'MyApp'\n\n    pod \"TraceLog\", '~\u003e5.0'\n    pod \"TraceLog/ObjC\", '~\u003e5.0'\n```\n\n### Import TraceLog and Start logging\n\nImport TraceLog into you files and start logging.\n\n```swift\n    import TraceLog\n\n    struct MyStruct {\n\n        func doSomething() {\n\n            logInfo { \"A simple TraceLog Test message\" }\n        }\n    }\n```\n\n### Log Functions\n\nTraceLog has the following primary logging functions to log various levels of information.  The output of these can be controlled via the environment variables at runtime or programmatically at application startup via the `TraceLog.configure()` func.\n\n```swift\n    logError  (tag: String?, message: @escaping () -\u003e String)\n    logWarning(tag: String?, message: @escaping () -\u003e String)\n    logInfo   (tag: String?, message: @escaping () -\u003e String)\n    logTrace  (tag: String?, level: UInt, message: @escaping () -\u003e String)\n    logTrace  (level: UInt, @escaping message: () -\u003e String)\n```\n\u003e Note: hidden parameters and defaults were omitted for simplicity.\n\n### Basic Configuration\n\nAlthough not strictly require, calling the `TraceLog.configure()` command at startup will allow TraceLog to read the environment for configuration information.\n\nSimply call configure with no parameters as early as possible in your startup code (preferably before ay log statements get called.)\n\n```swift\n    TraceLog.configure()\n```\n\n\u003e For a complete documentation set including user guides, a 100% documented API reference and many more examples, please see [https://tonystone.io/tracelog](https://tonystone.io/tracelog).\n\n## Runtime Overhead\n\nThe **Swift** implementation was designed to take advantage of swift compiler optimizations and will incur **no overhead** when compiled with optimization on (`-O`) and `TRACELOG_DISABLED` is defined.\n\nThe **Objective-C** implementation was designed to take advantage of the preprocessor and when compiled with `TRACELOG_DISABLED` defined, will incur **no overhead** in the application.\n\nFor XCode `TRACELOG_DISABLED` can be set in the project target. For **Swift Package Manager** pass a swiftc directive to `swift build` as in the following example.\n\n`swift build -Xswiftc -DTRACELOG_DISABLED`\n\n## Minimum Requirements\n\nBuild Environment\n\n| Platform | Version                    | Swift | Swift Build |   Xcode    |\n|:--------:|:--------------------------:|:-----:|:-----------:|:----------:|\n| Linux    | Ubuntu 14.04, 16.04, 16.10 | 5.0   | \u0026#x2714;    | \u0026#x2718;   |\n| OSX      | 10.13                      | 5.0   | \u0026#x2714;    | Xcode 10.x |\n\nMinimum Runtime Version\n\n| iOS |  OS X | tvOS | watchOS | Linux                      |\n|:---:|:-----:|:----:|:-------:|:--------------------------:|\n| 9.0 | 10.13 | 9.0  |   2.0   | Ubuntu 14.04, 16.04, 16.10 |\n\n\u003e **Note:**\n\u003e\n\u003e To build and run on **Linux** we have a a pre-configured **Vagrant** file located at [https://github.com/tonystone/vagrant-swift](https://github.com/tonystone/vagrant-swift)\n\u003e\n\u003e See the [README](https://github.com/tonystone/vagrant-swift/blob/master/README.md) for instructions.\n\u003e\n\n## Installation (Swift Package Manager)\n\nTraceLog now supports dependency management via Swift Package Manager on All Apple OS variants as well as Linux.\n\nPlease see [Swift Package Manager](https://swift.org/package-manager/#conceptual-overview) for further information.\n\n## Installation (CocoaPods)\n\nTraceLog is available through [CocoaPods](http://cocoapods.org). See the [Quick Start Guide](#quick-start-guide) for installing through CocoaPods.\n\nSee the [\"Using CocoaPods\"](https://guides.cocoapods.org/using/using-cocoapods.html) guide for more information on CocoaPods itself.\n\n## Author\n\nTony Stone ([https://github.com/tonystone](https://github.com/tonystone))\n\n## License\n\nTraceLog is released under the [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonystone%2Ftracelog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftonystone%2Ftracelog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftonystone%2Ftracelog/lists"}