Colorful, flexible, lightweight logging for Swift 4.
Example of output in Xcode Console:
23:21:37.635 [VERBOSE] [OrdersVC.viewDidLoad():24] - Some non important information
23:21:37.636 [DEBUG] [OrdersVC.viewDidLoad():25] - Some useful information just to debugging
23:21:37.636 [INFO] [OrdersVC.viewDidLoad():26] - Useful information, etc
23:21:37.636 [WARNING] [OrdersVC.viewDidLoad():27] - Not a good information
23:21:37.636 [ERROR] [OrdersVC.viewDidLoad():28] - Some important error
23:21:37.636 [CRITICAL] [OrdersVC.viewDidLoad():29] - Something went so wrong with critical priority
Or one more example:
To use EXPLogger with CocoaPods add this to your Podfile:
pod 'EXPLogger', '~> 1.0.3'
Then run pod install. For details of the installation and usage of CocoaPods, visit it's official web site.
Will be available soon.
Will be available soon.
This quick start method is intended just to get you up and running with the EXPLogger. You should however use the advanced usage below to get the most out of this library.
Add this code at the top of your AppDelegate.swift to be able to use EXPLogger in your whole project. Or just use it in your individual classes. It's up to you.
import EXPLogger
let log = EXPLogger.self
In the AppDelegate method didFinishLaunchingWithOptions() add the EXPLogger log targets (console, file, etc.). And it's ready to use.
// add log targets (important! at least one is needed)
let console = ConsoleTarget() // xcode console
// add the targets to log
log.addTarget(console)
// log anything you want in your whole project!
log.verbose("Some non important information that can be easily skipped")
log.debug("Some useful information just to debugging")
log.info("Useful information, etc")
log.warning("Not a good information")
log.error("Some error")
log.critical("Something went so wrong with critical prior")
The different methods set the log level of the message. EXPLogger will only print messages with a log level that is greater to or equal to it's current log level setting. So a logger with a level of .error will only output log messages with a level of .error, or .critical.
You can log simple strings:
log.debug("Hi there, I'm EXPLogger!")
Or just anything you want, for example:
log.debug((4, 2, 1, 0, 5)) // array
log.debug(true) // boolean
log.debug(CGPoint(x: 1.1, y: 2.2)) // something like this
log.debug(Enum.Option) // enums
EXPLogger allows for much greater control and flexibility.
EXPlogger can be configured to deliver log messages to a variety of destinations. Using the basic setup above, the logger will output log messages to the standard Xcode debug console just in a few lines of setup.
// add log targets
let console = ConsoleTarget() // xcode console
console.showDate = false // (default is true)
console.showLogTag = true // (default is true)
console.showFileName = true // (default is true)
console.showFunctionName = false // (default is true)
console.showThreadName = true // (default is false) *will be available soon
console.showLineNumber = true // (default is true)
console.showLevel = false // (default is true)
console.showFileSuffix = true // (default is true)
console.enableColors = false // (default is false) *not working for now in Xcode 8
console.defaultDateFormat = "HH:mm:ss" // (default is "HH:mm:ss.SSS")
console.defaultTimeZone = "UTC" // (default will be TimeZone.Current)
// add the targets to log
log.addTarget(console)
// log anything you want in your whole project!
...
If you don't configure these functions, EXPLogger will work based on default values.
Will be filled soon.
Will be filled soon.
See CHANGELOG.
EXPLogger Library is released under the MIT License.