Light weight Swift console logger with sevirity levels and built in Emojis
- Clone this git
- Drag Logger.swift file into xCode
- Select "Copy Files" from dialog
Add the following line to your Podfile:
pod 'Emoji-Logger'
Add the following line to your Cartfile:
github "alongenosar/Emoji-Logger"
Swift Examples.
Set Logger sevirity output level
Logger.logLevel = .info
Log with sevirity 'info'
Logger.log(level:.info,"message","more information")
//You can also omit the level as .info is the default sevirity level
Logger.log("message","more information")
//Or
Logger.info("message","more information")
In the Debug window this will result with
🔵info: message more information
Log with sevirity 'warning'
Logger.log(level:.warning,"warning message","more warning information")
//Or
Logger.warning("warning message","more warning information")
In the Debug window this will result with:
🔶warning: warning message more warning information
Log with sevirity 'error'
Logger.log(level:.error,"error message,","more stuff")
//Or
Logger.error("error message,","more stuff")
In the Debug window this will result with
🔴error: error message, more stuff
Override message prefix regardless to its sevirity level
Logger.log("apple message",["foo:"bar"],prefixOverride:"🍏apple:")
in debug area
🍏apple: apple message {"foo":"bar"}
Change level prefix
Logger.set(prefix: "** ERROR **", forLevel: .error)
Logger.error("error message,"more stuff")
//in debug area
** ERROR ** error message, more stuff
Mute/Unmute level: Suppresses logs from a certain level/s
Logger.mute(level:.info)
Logger.unmute(level.info
Logger.muteAllBut(level:.info)
Logger.unmuteAll()