All Projects → amereid → Mimir

amereid / Mimir

Licence: MIT license
📱 A simple & efficient iOS logging framework for high usage apps

Programming Languages

swift
15916 projects
objective c
16641 projects - #2 most used programming language
ruby
36898 projects - #4 most used programming language
c
50402 projects - #5 most used programming language

Projects that are alternatives of or similar to Mimir

Rz Go
Ripzap - Fast and 0 allocs leveled JSON logger for Go ⚡️. Dependency free.
Stars: ✭ 256 (+1869.23%)
Mutual labels:  fast, logs
Retc
An application used to convert razer effects to multiple output sdks.
Stars: ✭ 54 (+315.38%)
Mutual labels:  fast, efficient
Mockolo
Efficient Mock Generator for Swift
Stars: ✭ 327 (+2415.38%)
Mutual labels:  fast, efficient
Golog
A high-performant Logging Foundation for Go Applications. X3 faster than the rest leveled loggers.
Stars: ✭ 208 (+1500%)
Mutual labels:  log, logs
jazzle
An Innovative, Fast Transpiler for ECMAScript 2015 and later
Stars: ✭ 65 (+400%)
Mutual labels:  fast, efficient
gologger
A concurrent, fast queue/service worker based filesystem logging system perfect for servers with concurrent connections
Stars: ✭ 16 (+23.08%)
Mutual labels:  fast, log
Dua Cli
View disk space usage and delete unwanted data, fast.
Stars: ✭ 744 (+5623.08%)
Mutual labels:  fast, efficient
ULogViewer
Cross-Platform Universal Log Viewer.
Stars: ✭ 64 (+392.31%)
Mutual labels:  log, logs
PyGLM
Fast OpenGL Mathematics (GLM) for Python
Stars: ✭ 167 (+1184.62%)
Mutual labels:  fast, efficient
Amber
A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance.
Stars: ✭ 2,345 (+17938.46%)
Mutual labels:  fast, efficient
Teler
Real-time HTTP Intrusion Detection
Stars: ✭ 1,248 (+9500%)
Mutual labels:  log, logs
l
Cross-platform html/io [L]ogger with simple API.
Stars: ✭ 26 (+100%)
Mutual labels:  log, logs
Serverless Es Logs
A Serverless plugin to transport logs to ElasticSearch
Stars: ✭ 51 (+292.31%)
Mutual labels:  log, logs
sabotage
a radical and experimental distribution based on musl libc and busybox
Stars: ✭ 502 (+3761.54%)
Mutual labels:  fast, efficient
Gollum
An n:m message multiplexer written in Go
Stars: ✭ 883 (+6692.31%)
Mutual labels:  log, logs
Lizard
Lizard (formerly LZ5) is an efficient compressor with very fast decompression. It achieves compression ratio that is comparable to zip/zlib and zstd/brotli (at low and medium compression levels) at decompression speed of 1000 MB/s and faster.
Stars: ✭ 408 (+3038.46%)
Mutual labels:  fast, efficient
PoShLog
🔩 PoShLog is PowerShell cross-platform logging module. It allows you to log structured event data into console, file and much more places easily. It's built upon great C# logging library Serilog - https://serilog.net/
Stars: ✭ 108 (+730.77%)
Mutual labels:  log, logs
ptkdev-logger
🦒 Beautiful Logger for Node.js: the best alternative to the console.log statement
Stars: ✭ 117 (+800%)
Mutual labels:  log, logs
Borer
Efficient CBOR and JSON (de)serialization in Scala
Stars: ✭ 131 (+907.69%)
Mutual labels:  fast, efficient
LogDNA-Android-Client
Android client for LogDNA
Stars: ✭ 22 (+69.23%)
Mutual labels:  log, logs

CI Status Pods Version License Platform

Logging framework for high usage iOS Apps

Overview

Mimir is a logging framework (Swift & 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.

Unlike 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.

Use Case

This framework is intended for apps that:

  • log extremely frequently
  • log server responses that take up a lot of space in conventional logging mechanisms
  • send their logs to developers remotely
  • are very bandwidth conscious

Logs are also printed to console.

How it works

Mimir does this by creating 2 text files:

  • truncated text file
  • extended text file

Mimir starts out by filling up the extended logs text file until it reaches a certain file size. Once 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.

This mechanism guarantees that the earliest log messages are logged fully while older log messages are truncated.

Log Levels

There are several different log levels for you to use:

  • 🟡 trace
  • 🟢 verbose
  • 🔵 debug
  • 🟣 info
  • 🟠 warning
  • 🔴 error

Log Sample

Logging automatically adds the following for each log message:

  • Log level
  • File name
  • Function name
  • Line number
  • Log message (if not trace)
🟡 18:30:15.697 TRACE [File->SwiftExampleViewController.swift] (Func->mimirTestButtonTapped(_:)) [Line->29]
🟢 18:30:15.699 VERBOSE [File->SwiftExampleViewController.swift] (Func->mimirTestButtonTapped(_:)) [Line->30]: "This is a verbose log"
🔵 18:30:15.699 DEBUG [File->SwiftExampleViewController.swift] (Func->mimirTestButtonTapped(_:)) [Line->31]: "This is a debug log"
🟣 18:30:15.699 INFO [File->SwiftExampleViewController.swift] (Func->mimirTestButtonTapped(_:)) [Line->32]: "This is a info log"
🟠 18:30:15.699 WARNING [File->SwiftExampleViewController.swift] (Func->mimirTestButtonTapped(_:)) [Line->33]: "This is a warning log"
🔴 18:30:15.699 ERROR [File->SwiftExampleViewController.swift] (Func->mimirTestButtonTapped(_:)) [Line->34]: "This is a error log"

Usage - Swift

Setup

Setting up Mimir should happen before logging begins, preferably at the beginning of didFinishLaunchingWithOptions in the AppDelegate.

import Mimir // Do not forget this

let fileDestination = MMRFileDestination(nameOfFile: "sample")
Mimir.addDestination(fileDestination)

let consoleDestination = MMRConsoleDestination()
Mimir.addDestination(consoleDestination)

The fileDestination can also be customized:

  • maxExtendedSize -> max size of extended logs file (Default 5MB)
  • maxTruncatedSize -> max size of truncated logs file (Default 3MB)
  • maxTruncatedLogLength -> max length of log message that is moved to truncated logs file (Default 1024)
  • extraPercentageToStartDeletion -> buffer for when to delete overflowing logs (Default 0.2)

Example:

let fileDestination = MMRFileDestination(nameOfFile: "sample")

fileDestination.maxExtendedSize = 6_000_000
fileDestination.maxTruncatedSize = 4_000_000
fileDestination.maxTruncatedLogLength = 1_000
fileDestination.extraPercentageToStartDeletion = 0.4

Mimir.addDestination(fileDestination)

Basic Logging

import Mimir // Do not forget this

Mimir.verbose("This is a verbose log")
Mimir.debug("This is a debug log")
Mimir.info("This is a info log")
Mimir.warning("This is a warning log")
Mimir.error("This is a error log")

Fetching Logs

Fetching logs is very easy and straightforward and there are multiple ways to fetch the logs:

import Mimir // Do not forget this

// Gets an array of URL objects for the logs text files
let _ = Mimir.getLogsPaths()

// Gets the path of the folder containing the logs as a String
let _ = Mimir.getLogsDirectoryPath()

// Gets logs as a string while limiting number of bytes
let _ = Mimir.getLogsAsString(limitInBytes: 500)

Usage - Objective-C

Setup

Setting up Mimir should happen before logging begins, preferably at the beginning of didFinishLaunchingWithOptions in the AppDelegate.

#import <Mimir/Mimir-Swift.h> // Do not forget this

MMRFileDestination* fileDestination = [[MMRFileDestination alloc] initWithNameOfFile:@"sample"];
[Mimir addDestination:fileDestination];

MMRConsoleDestination *consoleDestintion = [[MMRConsoleDestination alloc] init];
[Mimir addDestination:consoleDestintion];

The fileDestination can also be customized:

  • maxExtendedSize -> max size of extended logs file (Default 5MB)
  • maxTruncatedSize -> max size of truncated logs file (Default 3MB)
  • maxTruncatedLogLength -> max length of log message that is moved to truncated logs file (Default 1024)
  • extraPercentageToStartDeletion -> buffer for when to delete overflowing logs (Default 0.2)

Example:

MMRFileDestination* fileDestination = [[MMRFileDestination alloc] initWithNameOfFile:@"sample"];

fileDestination.maxExtendedSize = 6000000;
fileDestination.maxTruncatedSize = 4000000;
fileDestination.maxTruncatedLogLength = 1000;
fileDestination.extraPercentageToStartDeletion = 0.4;

[Mimir addDestination:fileDestination];

Basic Logging

The Objective-C functions for logging are macros and are used as such:

#import <Mimir/MimirObjC.h>

MimirTrace();
MimirVerbose(@"This is a verbose log");
MimirDebug(@"This is a debug log");
MimirInfo(@"This is a info log");
MimirWarning(@"This is a warning log");
MimirError(@"This is a error log");

Formatting log in objective is quite easy using the macros as well:

MimirVerbose(@"This is a %@'s verbose log", @"Amer's");

🟢 18:42:56.702 VERBOSE [File->ObjCExampleViewController.m] (Func->mimirTestButtonTapped:) [Line->36]: "This is a Amer's's verbose log"

Fetching Logs

Fetching logs is very easy and straightforward and there are multiple ways to fetch the logs:

#import <Mimir/MimirObjC.h> // Do not forget this

// Gets an array of URL objects for the logs text files
NSArray<NSURL*> *logsPaths = [Mimir getLogsPaths];

// Gets the path of the folder containing the logs as a String
NSString* logsDirectoryPath = [Mimir getLogsDirectoryPath];

// Gets logs as a string while limiting number of bytes
NSString* truncatedLogsString = [Mimir getLogsAsStringWithLimitInBytes:500];

Notes

This framework is still in the early phases and will keep evolving.

If you use this framework and happen to like it, feel free to let me know 😊

Installation

Mimir is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'Mimir'

Author

Amer Eid, [email protected]

License

Mimir is available under the MIT license. See the LICENSE file for more info.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].