ColorLog
Getting Started
ColorLog is avaliable with CocoaPods. To use CocoaPods in your project, navigate to your project using terminal and enter the following commands:
If you have never used any Pods in your project yet: (skip this if your already have a Podfile
):
pod init
Now add ColorLog using your favourite command line editor. Add the following line into your Podfile
under the target [YOUR PROJECT NAME]
pod 'ColorLog'
Finally run in terminal:
pod install
How to Use
Anywhere in your project if you would like to debug and print use:
Log.test("this is a test")
Which will print in the following format:
13:51:38.487 TEST ❇️❇️❇️❇️ in ViewController.swift:viewDidLoad():28:: this is a test
It can be used to print non String as well
Log.test(UIView())
Output:
14:20:00.313 TEST ❇️❇️❇️❇️ in ViewController.swift:viewDidLoad():28:: Optional(<UITableView: 0x7fdbf4058600; frame = (0 20; 375 647); clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = <NSArray: 0x7fdbf1f60f20>; layer = <CALayer: 0x7fdbf307f7d0>; contentOffset: {0, 0}; contentSize: {375, 19920}; adjustedContentInset: {0, 0, 0, 0}>)
Types of Logs
All of the logs printed are color/emoji-coded. Aka recognizable by emoji/color.
- Debug:
DEBUG 🐝🐝🐝🐝
- Info:
INFO 🖤🖤🖤🖤
- Warn:
WARN ⚠️⚠️⚠️⚠️
- Error:
ERROR 🛑🛑🛑🛑
- Test:
TEST ❇️❇️❇️❇️
- Monitor:
MONITOR 🔥🔥🔥🔥
By default, debug and info logs are silenced To change this, set the logLevel
to be either .DEBUG
or .INFO
(no debugs, just info logs)
Contributions
Feel free to submit any issues for any bugs or make any improvements on the basic Log file.
License
ColorLog is available under the MIT license. See the LICENSE file for more info.