{"id":20178620,"url":"https://github.com/anxiousholiday/mimir","last_synced_at":"2025-04-10T04:42:28.337Z","repository":{"id":62447805,"uuid":"297047858","full_name":"AnxiousHoliday/Mimir","owner":"AnxiousHoliday","description":"📱 A simple \u0026 efficient iOS logging framework for high usage apps","archived":false,"fork":false,"pushed_at":"2020-10-07T22:40:03.000Z","size":313,"stargazers_count":13,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-24T05:52:16.034Z","etag":null,"topics":["apps","efficient","fast","framework","high","ios","log","logging","logs","mimir","objective-c","pretty","swift","usage"],"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/AnxiousHoliday.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":"2020-09-20T10:02:30.000Z","updated_at":"2020-10-12T16:34:06.000Z","dependencies_parsed_at":"2022-11-01T23:02:08.094Z","dependency_job_id":null,"html_url":"https://github.com/AnxiousHoliday/Mimir","commit_stats":null,"previous_names":["amereid/mimir"],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnxiousHoliday%2FMimir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnxiousHoliday%2FMimir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnxiousHoliday%2FMimir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AnxiousHoliday%2FMimir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AnxiousHoliday","download_url":"https://codeload.github.com/AnxiousHoliday/Mimir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248161215,"owners_count":21057552,"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":["apps","efficient","fast","framework","high","ios","log","logging","logs","mimir","objective-c","pretty","swift","usage"],"created_at":"2024-11-14T02:21:59.215Z","updated_at":"2025-04-10T04:42:28.309Z","avatar_url":"https://github.com/AnxiousHoliday.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cimg src=\"./Resources/mimir-logo.png\" width=400 /\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n    \u003ca href=\"https://cocoapods.org/pods/Mimir\"\u003e\n      \u003cimg src=\"https://img.shields.io/travis/amereid/Mimir.svg?style=flat)](https://travis-ci.org/amereid/Mimir\"\n           alt=\"CI Status\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://cocoapods.org/pods/Mimir\"\u003e\n      \u003cimg src=\"https://img.shields.io/cocoapods/v/Mimir.svg?style=flat)](https://cocoapods.org/pods/Mimir\"\n           alt=\"Pods Version\" /\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://cocoapods.org/pods/Mimir\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/l/Mimir.svg?style=flat\"\n             alt=\"License\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://cocoapods.org/pods/Mimir\"\u003e\n        \u003cimg src=\"https://img.shields.io/cocoapods/p/Mimir.svg?style=flat\"\n             alt=\"Platform\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n## Logging framework for high usage iOS Apps\n\n## Overview\nMimir is a logging framework (Swift \u0026 Objective-C) that is intended for use in high usage apps that log extensively and would like to keep as much logging record as possible all while using the least amount of disk space.\n\nUnlike other logging frameworks, Mimir logs to text files but tries to maintain as much logging info as possible while using the least amount of disk space.\n\n## Use Case\n\nThis framework is intended for apps that:\n\n* log extremely frequently\n* log server responses that take up a lot of space in conventional logging mechanisms\n* send their logs to developers remotely\n* are very bandwidth conscious\n\nLogs are also printed to console.\n\n## How it works\n\nMimir does this by creating 2 text files:\n\n* truncated text file\n* extended text file\n\nMimir starts out by filling up the extended logs text file until it reaches a certain file size.\nOnce the extended logs file is full, the oldest logs are removed from the end of the extended logs file and are moved to the truncated file and then truncated accordingly.\n\nThis mechanism guarantees that the earliest log messages are logged fully while older log messages are truncated.\n\n## Log Levels\n\nThere are several different log levels for you to use:\n\n* 🟡 trace\n* 🟢 verbose\n* 🔵 debug\n* 🟣 info\n* 🟠 warning\n* 🔴 error\n\n## Log Sample\n\nLogging automatically adds the following for each log message:\n\n* Log level\n* File name\n* Function name\n* Line number\n* Log message (if not trace)\n\n```swift\n🟡 18:30:15.697 TRACE [File-\u003eSwiftExampleViewController.swift] (Func-\u003emimirTestButtonTapped(_:)) [Line-\u003e29]\n🟢 18:30:15.699 VERBOSE [File-\u003eSwiftExampleViewController.swift] (Func-\u003emimirTestButtonTapped(_:)) [Line-\u003e30]: \"This is a verbose log\"\n🔵 18:30:15.699 DEBUG [File-\u003eSwiftExampleViewController.swift] (Func-\u003emimirTestButtonTapped(_:)) [Line-\u003e31]: \"This is a debug log\"\n🟣 18:30:15.699 INFO [File-\u003eSwiftExampleViewController.swift] (Func-\u003emimirTestButtonTapped(_:)) [Line-\u003e32]: \"This is a info log\"\n🟠 18:30:15.699 WARNING [File-\u003eSwiftExampleViewController.swift] (Func-\u003emimirTestButtonTapped(_:)) [Line-\u003e33]: \"This is a warning log\"\n🔴 18:30:15.699 ERROR [File-\u003eSwiftExampleViewController.swift] (Func-\u003emimirTestButtonTapped(_:)) [Line-\u003e34]: \"This is a error log\"\n```\n\n# Usage - Swift\n\n## Setup\n\nSetting up Mimir should happen before logging begins, preferably at the beginning of didFinishLaunchingWithOptions in the AppDelegate.\n\n```swift\nimport Mimir // Do not forget this\n\nlet fileDestination = MMRFileDestination(nameOfFile: \"sample\")\nMimir.addDestination(fileDestination)\n\nlet consoleDestination = MMRConsoleDestination()\nMimir.addDestination(consoleDestination)\n```\n\nThe fileDestination can also be customized:\n\n* maxExtendedSize -\u003e max size of extended logs file (Default 5MB)\n* maxTruncatedSize -\u003e max size of truncated logs file (Default 3MB)\n* maxTruncatedLogLength -\u003e max length of log message that is moved to truncated logs file (Default 1024)\n* extraPercentageToStartDeletion -\u003e buffer for when to delete overflowing logs (Default 0.2)\n\nExample:\n\n```swift\nlet fileDestination = MMRFileDestination(nameOfFile: \"sample\")\n\nfileDestination.maxExtendedSize = 6_000_000\nfileDestination.maxTruncatedSize = 4_000_000\nfileDestination.maxTruncatedLogLength = 1_000\nfileDestination.extraPercentageToStartDeletion = 0.4\n\nMimir.addDestination(fileDestination)\n```\n\n## Basic Logging\n\n```swift\nimport Mimir // Do not forget this\n\nMimir.verbose(\"This is a verbose log\")\nMimir.debug(\"This is a debug log\")\nMimir.info(\"This is a info log\")\nMimir.warning(\"This is a warning log\")\nMimir.error(\"This is a error log\")\n```\n\n## Fetching Logs\n\nFetching logs is very easy and straightforward and there are multiple ways to fetch the logs:\n\n```swift\nimport Mimir // Do not forget this\n\n// Gets an array of URL objects for the logs text files\nlet _ = Mimir.getLogsPaths()\n\n// Gets the path of the folder containing the logs as a String\nlet _ = Mimir.getLogsDirectoryPath()\n\n// Gets logs as a string while limiting number of bytes\nlet _ = Mimir.getLogsAsString(limitInBytes: 500)\n```\n\n# Usage - Objective-C\n\n## Setup\n\nSetting up Mimir should happen before logging begins, preferably at the beginning of didFinishLaunchingWithOptions in the AppDelegate.\n\n```objective-c\n#import \u003cMimir/Mimir-Swift.h\u003e // Do not forget this\n\nMMRFileDestination* fileDestination = [[MMRFileDestination alloc] initWithNameOfFile:@\"sample\"];\n[Mimir addDestination:fileDestination];\n\nMMRConsoleDestination *consoleDestintion = [[MMRConsoleDestination alloc] init];\n[Mimir addDestination:consoleDestintion];\n```\n\nThe fileDestination can also be customized:\n\n* maxExtendedSize -\u003e max size of extended logs file (Default 5MB)\n* maxTruncatedSize -\u003e max size of truncated logs file (Default 3MB)\n* maxTruncatedLogLength -\u003e max length of log message that is moved to truncated logs file (Default 1024)\n* extraPercentageToStartDeletion -\u003e buffer for when to delete overflowing logs (Default 0.2)\n\nExample:\n\n```objective-c\nMMRFileDestination* fileDestination = [[MMRFileDestination alloc] initWithNameOfFile:@\"sample\"];\n\nfileDestination.maxExtendedSize = 6000000;\nfileDestination.maxTruncatedSize = 4000000;\nfileDestination.maxTruncatedLogLength = 1000;\nfileDestination.extraPercentageToStartDeletion = 0.4;\n\n[Mimir addDestination:fileDestination];\n```\n\n## Basic Logging\n\nThe Objective-C functions for logging are macros and are used as such:\n\n```objective-c\n#import \u003cMimir/MimirObjC.h\u003e\n\nMimirTrace();\nMimirVerbose(@\"This is a verbose log\");\nMimirDebug(@\"This is a debug log\");\nMimirInfo(@\"This is a info log\");\nMimirWarning(@\"This is a warning log\");\nMimirError(@\"This is a error log\");\n```\n\nFormatting log in objective is quite easy using the macros as well:\n\n```objective-c\nMimirVerbose(@\"This is a %@'s verbose log\", @\"Amer's\");\n\n🟢 18:42:56.702 VERBOSE [File-\u003eObjCExampleViewController.m] (Func-\u003emimirTestButtonTapped:) [Line-\u003e36]: \"This is a Amer's's verbose log\"\n```\n\n## Fetching Logs\n\nFetching logs is very easy and straightforward and there are multiple ways to fetch the logs:\n\n```objective-c\n#import \u003cMimir/MimirObjC.h\u003e // Do not forget this\n\n// Gets an array of URL objects for the logs text files\nNSArray\u003cNSURL*\u003e *logsPaths = [Mimir getLogsPaths];\n\n// Gets the path of the folder containing the logs as a String\nNSString* logsDirectoryPath = [Mimir getLogsDirectoryPath];\n\n// Gets logs as a string while limiting number of bytes\nNSString* truncatedLogsString = [Mimir getLogsAsStringWithLimitInBytes:500];\n```\n\n## Notes\n\nThis framework is still in the early phases and will keep evolving.\n\nIf you use this framework and happen to like it, feel free to let me know 😊\n\n## Installation\n\nMimir is available through [CocoaPods](https://cocoapods.org). To install\nit, simply add the following line to your Podfile:\n\n```swift\npod 'Mimir'\n```\n\n## Author\n\nAmer Eid, amereid92@gmail.com\n\n## License\n\nMimir 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%2Fanxiousholiday%2Fmimir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanxiousholiday%2Fmimir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanxiousholiday%2Fmimir/lists"}