{"id":15293656,"url":"https://github.com/shial4/logswift","last_synced_at":"2025-05-07T04:11:41.544Z","repository":{"id":63920497,"uuid":"105755030","full_name":"shial4/LogSwift","owner":"shial4","description":"Simple yet advanced swift logger","archived":false,"fork":false,"pushed_at":"2021-09-12T07:50:54.000Z","size":202,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T04:11:33.224Z","etag":null,"topics":["consolelog","filelogger","logger","logging","swift","swift-logger","swift4"],"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/shial4.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":"2017-10-04T10:14:07.000Z","updated_at":"2024-06-29T08:22:19.000Z","dependencies_parsed_at":"2023-01-14T14:00:18.775Z","dependency_job_id":null,"html_url":"https://github.com/shial4/LogSwift","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shial4%2FLogSwift","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shial4%2FLogSwift/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shial4%2FLogSwift/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shial4%2FLogSwift/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shial4","download_url":"https://codeload.github.com/shial4/LogSwift/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252810274,"owners_count":21807759,"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":["consolelog","filelogger","logger","logging","swift","swift-logger","swift4"],"created_at":"2024-09-30T16:50:25.982Z","updated_at":"2025-05-07T04:11:41.511Z","avatar_url":"https://github.com/shial4.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SLLog\n\n\u003cp align=\"center\"\u003e\n\u003ca href=\"https://swift.org\"\u003e\n    \u003cimg src=\"http://img.shields.io/badge/swift-5.2-brightgreen.svg\" alt=\"Swift 5.2\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://raw.githubusercontent.com/shial4/SLLog/master/LICENSE\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/shial4/LogSwift/actions\"\u003e\n    \u003cimg src=\"https://github.com/shial4/LogSwift/workflows/test/badge.svg\" alt=\"Continuous Integration\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://codebeat.co/projects/github-com-sllog-sllog-master\"\u003e\n    \u003cimg src=\"https://codebeat.co/badges/34b30a6f-29dd-4870-8f95-922267cef054\" alt=\"Codebeat\" /\u003e\n\u003c/a\u003e\n\u003c/p\u003e\n\nSLLog is a simple yet elegant swift logger. Allows you to log content to file, console or your custom target.\n\n```swift\n1990-02-19T22:45:36.250Z [VERBOSE] MyFile.swift:19 - 123\n1991-03-20T20:33:44.777Z [INFO] MyFile.swift:20 - ABC\n1992-04-21T09:53:51.021Z [DEBUG] MyFile.swift:21 - @$#!^%\n1993-05-22T11:05:02.000Z [WARNING] MyFile.swift:22 - 2017-10-04 22:45:36 +0000\n1994-06-23T15:13:00.146Z [ERROR] MyFile.swift:23 - [0.10000000000000001, 1, \"A\", 2017-10-04 09:55:36 +0000]\n```\n\n\u003cp align=\"center\"\u003e\n\u003cimg src=\"Images/terminal.png\" alt=\"Terminal\" /\u003e\n\u003cimg src=\"Images/console.png\" alt=\"Console\" /\u003e\n\u003c/p\u003e\n\n## 🔧 Installation\n\nAdd the following dependency to your `Package.swift` file:\n```swift\n.package(url: \"https://github.com/SLLog/SLLog\", from: \"1.1.0\"),\n```\n\n## 💊 How To Start\n\n### 1 Import\n\nOn top of your file import:\n```swift\nimport SLLog\n```\n\n### 2 Usage\n\nLog any information you need with `Log` class\n```swift\nLog.d(\"ABC\")\nLog.w(\"#%^$\u0026@\")\nLog.e(\"1233\")\n```\nAny object.\n```swift\nSLLog.addHandler(SLLogConsole())\nLog.v(123)\nLog.i(\"ABC\")\nLog.d(\"@$#!^%\")\nLog.w(Date())\nLog.e([0.1,1,\"A\",Date()])\n```\n\n### 3 Initialize\n\nSetup SLLoger\n```swift\nSLLog.addHandler(try! SLLogFile(\"path/to/directory\"))\n```\nOr console handler\n```swift\nSLLog.addHandler(SLLogConsole())\n```\nor both\n```swift\nSLLog.addHandler(SLLogConsole(), try! SLLogFile(path))\n```\nYou can create your custom log handler. Simply correspond to `LogHandler` protocol.\n\n```swift\npublic class MyHandler: LogHandler {\n    open func handle(message: Any, level: SLLog.LogType, file: String, line: UInt) {\n        //Do your stuff with log.\n    }\n}\n```\nthen add it to SLLog\n```swift\nSLLog.addHandler(MyHandler())\n```\n\n### 4 Providers\n\nSLLog can have custom providers. To add your own provider \n```swift\nstruct MySLLogProvider: LogProvider {}\nSLLog.addProvider(MySLLogProvider())\n```\ncan you can use `LogProvider` build in method send. To send your log via SLLog.\n\n## 5 SLLogConsole\nDefault console log:\n```swift\nisDebug: Bool = true,\nisTerminal: Bool = {\n        #if Xcode\n        return false\n        #else\n        return true\n        #endif\n    }(),\nminProductionLogType: UInt = 3\nlogFormat: String = \":d :t :f::l :m\",\ndateFormat: String? = nil,\nlogColors: [SLLog.LogType:LogColor]? = nil\n```\nOverride argument passing it in initializer to variate ConsoleLog\n`SLLogConsole(isDebug: true, isTerminal: false)`\nor\n`SLLogConsole(isTerminal: false)`\nand so on.\nUse isTerminal property to choose between terminal or console settings.\n`SLLogConsole(isTerminal: false)`\n\nTo fully configure SLLog pas `Configuration` object during initialisation.\n`public init(_ config: Configuration = Configuration())`\n\nBy default, logs are set for a terminal.\nlog format `\":d :t :f::l :m\"` where\n\n    `:d` is replaced in string to display date\n    `:t` is replaced by log type\n    `:f` is replaced by file name\n    `:l` is replaced by line number\n    `:m` is replaced by message object\n\nDefault date format used by logger is as follow `\"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'\"`\n\nTo get rid of default log colors pass empty dictionary in `logColors` or dictionary with your own definitions.\nFor more information about terminal color take a look: `https://misc.flogisoft.com/bash/tip_colors_and_formatting`\n\n### LogColor\n\nLogColor is defined as follow `init(_ terminal: String, _ console: String)`\nFor XCode console emoticons are used as collor.\n\n```swift\nSLLog.LogType.verbose:LogColor(TerminalColor.lightGray, \"☑️\"),\nSLLog.LogType.info:LogColor(TerminalColor.lightCyan, \"Ⓜ️\"),\nSLLog.LogType.debug:LogColor(TerminalColor.lightGreen, \"✅\"),\nSLLog.LogType.warning:LogColor(TerminalColor.lightYellow, \"⚠️\"),\nSLLog.LogType.error:LogColor(TerminalColor.lightRed, \"⛔️\"),\n```\nUse `TerminalColor`  to fast access predefined colors values\n\n## 5 SLLogFile\nSLLogFile save logs to files which are created on daily basis.\nFile names are as follows: `\"yyyy-MM-dd\"`. Created under `:yuorPath/sllogs` with extension `.log`\nDefault `maxFilesCount` is set to `3` wich means logger stores 3 files at a time.\n1 file = 1 day logs\n\n\n## ⭐ Contributing\n\nBe welcome to contribute to this project! :)\n\n## ❓ Questions\n\nYou can create an issue on GitHub.\n\n## 📝 License\n\nThis project was released under the [MIT](LICENSE) license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshial4%2Flogswift","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshial4%2Flogswift","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshial4%2Flogswift/lists"}