{"id":27296869,"url":"https://github.com/lengocduy/dllogging","last_synced_at":"2025-04-11T23:52:08.017Z","repository":{"id":49487031,"uuid":"272518704","full_name":"lengocduy/DLLogging","owner":"lengocduy","description":"Unify and modularize abstract logging framework written in Swift","archived":false,"fork":false,"pushed_at":"2021-10-25T18:06:38.000Z","size":2199,"stargazers_count":0,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-11T23:52:03.829Z","etag":null,"topics":["logger","logging","logging-framework","swift","swiftlog"],"latest_commit_sha":null,"homepage":"https://lengocduy.github.io/DLLogging/","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/lengocduy.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-06-15T18:50:00.000Z","updated_at":"2024-04-19T08:21:00.000Z","dependencies_parsed_at":"2022-08-24T20:20:21.363Z","dependency_job_id":null,"html_url":"https://github.com/lengocduy/DLLogging","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/lengocduy%2FDLLogging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lengocduy%2FDLLogging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lengocduy%2FDLLogging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lengocduy%2FDLLogging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lengocduy","download_url":"https://codeload.github.com/lengocduy/DLLogging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248497860,"owners_count":21113984,"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":["logger","logging","logging-framework","swift","swiftlog"],"created_at":"2025-04-11T23:52:07.208Z","updated_at":"2025-04-11T23:52:08.006Z","avatar_url":"https://github.com/lengocduy.png","language":"Swift","readme":"# DLLogging\n\n![CI](https://github.com/lengocduy/DLLogging/workflows/CI/badge.svg)\n[![Version](https://img.shields.io/cocoapods/v/DLLogging.svg?style=flat)](http://cocoapods.org/pods/DLLogging)\n[![License](https://img.shields.io/cocoapods/l/DLLogging.svg?style=flat)](http://cocoapods.org/pods/DLLogging)\n[![Platform](https://img.shields.io/cocoapods/p/DLLogging.svg?style=flat)](http://cocoapods.org/pods/DLLogging)\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)\n\nAn abstract Logging Framework supports:\n\n- Unified Logging.\n- Modularize, Centralize Logging.\n- Plugin the new logging easier.\n- Fully customize format logging's message.\n- Built-in Loggings\n  - Console Logging\n    - PrintLogging: Swift's print.\n    - PrintDebugLogging: Swift's debugPrint.\n  - File Logging\n    - Write the log message to file.\n    - It flushes the content as Data with a UTF-8 encoding and call back to client for process each configured TimeInterval and clear content.\n\n## Log Level supports\n\n1. 🗣 Verbose: A verbose message, usually useful when working on a specific problem.\n2. 🔍 Debug: A debug message that may be useful to a developer.\n3. ℹ️ Info: An info message that highlight the progress of the application at coarse-grained level.\n4. ⚠️ Warning: A warning message, may indicate a possible error.\n5. ❗️ Error: An error occurred, but it's recoverable, just info about what happened.\n6. 🛑 Severe: A server error occurred.\n\n## Requirements\n\n- Xcode 11+\n- Swift 5.0+\n\n## How\n\n### Setup\n\n1. Use Framework's default setup.\n\n```\nimport UIKit\nimport DLLogging\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n        // Override point for customization after application launch.\n        /// Setup Logging\n        LoggerManager.sharedInstance.initialize()\n        return true\n    }\n}\n```\n\n2. Use supported Loggings.\n\n```\nimport UIKit\nimport DLLogging\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n        /// Setup Logging\n        let logFormatter = LogFormatterImpl()\n        LoggerManager.sharedInstance.addLogging(LoggerFactoryImpl.makeConsoleLogging(logFormatter: logFormatter))\n        LoggerManager.sharedInstance.addLogging(LoggerFactoryImpl.makeFileLogging(fileName: \"logs\"))\n        /// Disable LogLevels. Enable all LogLevels by default\n        LoggerManager.sharedInstance.disableLogLevels([LogLevel.info, LogLevel.error])\n\n        return true\n    }\n}\n```\n\n3. Add your custom Logging.\n\n```\nimport UIKit\nimport DLLogging\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n        // Override point for customization after application launch.\n        /// Setup Logging\n        let logFormatter = LogFormatterImpl()\n        let testLogging = TestLogging(logFormatter: logFormatter)\n        LoggerManager.sharedInstance.addLogging(testLogging)\n        return true\n    }\n}\n\n/// Your custom Logging.\nfinal class TestLogging: BaseLogging {\n    let logger = OSLog.init(subsystem: \"com.domain.loggingdemo\", category: \"main\")  \n    override func receiveMessage(_ message: LogMessage) {\n        if let formattedMessage = logFormatter?.formatMessage(message) {\n            os_log(\"%@\", log: logger, type: OSLogType.debug, formattedMessage)\n        } else {\n            os_log(\"Your message %@\", message.text)\n        }\n    }\n}\n```\n\n4. Add your custom Formatter.\n\n```\nimport UIKit\nimport DLLogging\n\n@UIApplicationMain\nclass AppDelegate: UIResponder, UIApplicationDelegate {\n    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -\u003e Bool {\n        // Override point for customization after application launch.\n        /// Setup Logging\n        let logFormatter = CustomLoggingFormatter()\n        let testLogging = LoggerFactoryImpl.makeConsoleLogging(logFormatter: logFormatter)\n        LoggerManager.sharedInstance.addLogging(testLogging)\n        return true\n    }\n}\n\n/// Your custom Formatter\nfinal class CustomLoggingFormatter: LogFormatter {\n    func formatMessage(_ message: LogMessage) -\u003e String {\n        return \"[\\(message.level.symbol)][\\(message.function)] -\u003e \\(message.text)\"\n    }\n}\n```\n\n### Use\n\n```\n/// Invoke\nLog.info(message: \"info\")\nLog.debug(message: \"debug\")\nLog.verbose(message: \"verbose\")\nLog.warning(message: \"warning\")\nLog.error(message: \"error\")\nLog.severe(message: \"severe\")\n\n/// Output\n2020-07-16T18:50:09.254+0700 [ℹ️][ViewController.swift:18:viewDidLoad()] -\u003e info\n2020-07-16T18:50:09.256+0700 [🔍][ViewController.swift:19:viewDidLoad()] -\u003e debug\n2020-07-16T18:50:09.256+0700 [🗣][ViewController.swift:20:viewDidLoad()] -\u003e verbose\n2020-07-16T18:50:09.257+0700 [⚠️][ViewController.swift:21:viewDidLoad()] -\u003e warning\n2020-07-16T18:50:09.257+0700 [❗️][ViewController.swift:22:viewDidLoad()] -\u003e error\n2020-07-16T18:50:09.257+0700 [🛑][ViewController.swift:23:viewDidLoad()] -\u003e severe\n```\n\n## Installation\n\nThere are three ways to install `DLLogging`\n\n### CocoaPods\n\nJust add to your project's `Podfile`:\n\n```\npod 'DLLogging', '~\u003e 1.2'\n```\n\n### Carthage\n\nAdd following to `Cartfile`:\n\n```\ngithub \"lengocduy/DLLogging\" ~\u003e 1.2\n```\n\n- To building platform-independent xcframeworks xcode12 and above [here](https://github.com/Carthage/Carthage#building-platform-independent-xcframeworks-xcode-12-and-above)\n- To migrating from framework bundles to xcframework [here](https://github.com/Carthage/Carthage#migrating-a-project-from-framework-bundles-to-xcframeworks)\n\n### Swift Package Manager\n\nCreate a `Package.swift` file:\n\n```\n// swift-tools-version:5.0\n\nimport PackageDescription\n\nlet package = Package(\n        name: \"TestLogging\",\n\n        dependencies: [\n            .package(url: \"https://github.com/lengocduy/DLLogging.git\", from: \"1.2.0\"),\n        ],\n\n        targets: [\n            .target(\n                    name: \"TestLogging\",\n                    dependencies: [\"DLLogging\"])\n        ]\n)\n\n```\n\n## Architecture\n\n![Architecture](https://raw.githubusercontent.com/lengocduy/DLLogging/master/ArchDiagram.png)\n\n## Interaction Flow\n\n![Interaction Flow](https://raw.githubusercontent.com/lengocduy/DLLogging/master/InteractionFlow.png)\n\n## License\n\nDLLogging is available under the MIT license. See the [LICENSE](LICENSE.md) file for more info.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flengocduy%2Fdllogging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flengocduy%2Fdllogging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flengocduy%2Fdllogging/lists"}