LogMoji is here to help you parse through all your verbose log statements with meaningful, custom emojis that stand out! This simple logger has the ability to log to your console, a specified file path, or both! It also has the ability for you to set as many custom states as you would like. Make your log statements easier to read with LogMoji.
LogMoji is available through CocoaPods. To install it, simply add the following line to your Podfile:
pod 'LogMoji'
LogMoji makes it easy for you to get up and running quickly and easily! For basic usage you follow these steps:
import LogMoji
enum LogStates: String, State {
case success, critical, warning
var emoji: String {
switch self {
case .critical: return "🚨"
case .warning: return "⚠️"
case .success: return "✅"
}
}
var name: String { self.rawValue }
}
// Decide where to log & whether to show a timestamp
LogMoji.logger.logToConsole(true)
LogMoji.logger.setFilePath("Path/To/File.txt")
LogMoji.logger.showTimeStamp(false)
// Start Logging!
LogMoji.logger.logWith(state: Errors.success, message: "I am a successful LogMoji message!")
LogMoji.logger.logWith(state: Errors.warning, message: "I am a warning LogMoji message!")
LogMoji.logger.logWith(state: Errors.critical, message: "I am a CRITICAL LogMoji message!")
This method will take any number of states you would like to add to your app. Pass in an ID and associate it with the emoji of your choice!
This is the main method to actually log anything with LogMoji. Make sure to set your states and settings before using this.
Decide whether to log state to console.
Defaults to true
Set a file path of where you would like to output your logs! This has been tested with an absolute path only.
Defaults to nil
Decide wether you would like a timestamp prepended to your log.
Defaults to true
If a state cannot be found, the log statement will default to the defualtState emoji. This can be changed if desired.
Defaults to ❓
Set the default state emoji in the chance a specified state could not be found.
To run the example project, clone the repo, and run pod install
from the Example directory first. This simple application shows you the very basics of LogMoji.
Alec Dilanchian
Twitter
Twitch
Email
LogMoji is available under the MIT license. See the LICENSE file for more info.