This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let employee = [“name”:”Alex”,”empId”:123] as [String : Any] | |
print(employee,logLevel:.DEBUG) | |
print(10,logLevel:.WARNING) | |
print(employee,10,employee,55,logLevel:.DEBUG) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let employee = [“name”:”Alex”,”empId”:123] as [String : Any] | |
print(employee,logLevel:.DEBUG) | |
print(10, logLevel:.WARNING) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension YBLoggerConfiguration { | |
func addTimeStamp() -> Bool {return false} | |
func addFileName() -> Bool {return false} | |
func addFunctionName() -> Bool {return true} | |
func addLineNumber() -> Bool {return true} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
🔹 DEBUG ➯ 2017-07-23T13:43:57.135Z ⇨ ViewController ⇨ viewDidLoad() : 17 ⇨ One operation is completed. | |
🔸 INFO ➯ 2017-07-23T13:43:57.152Z ⇨ ViewController ⇨ viewDidLoad() : 18 ⇨ Operation | |
🚫 ERROR ➯ 2017-07-23T13:43:57.226Z ⇨ ViewController ⇨ viewDidLoad() : 19 ⇨ Divide by zero error | |
❗️ EXCEPTION ➯ 2017-07-23T13:43:57.226Z ⇨ ViewController ⇨ viewDidLoad() : 20 ⇨ Could not able to read the data. | |
⚠️ WARNING ➯ 2017-07-23T13:43:57.227Z ⇨ ViewController ⇨ viewDidLoad() : 21 ⇨ Only three items are left. | |
🔹 DEBUG ➯ 2017-07-23T13:43:57.228Z ⇨ ViewController ⇨ viewDidLoad() : 22 ⇨ ["name": "Alex", "empId": 123] | |
⚠️ WARNING ➯ 2017-07-23T13:43:57.228Z ⇨ ViewController ⇨ viewDidLoad() : 23 ⇨ 10 | |
🔹 DEBUG ➯ 2017-07-23T13:43:57.229Z ⇨ ViewController ⇨ viewDidLoad() : 24 ⇨ ["name": "Alex", "empId": 123] 10 ["name": "Alex", "empId": 123] 55 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func startDownload() { | |
let downloader = ImageDownloader(delegate: self) | |
let signpostID = OSSignpostID (log: SignpostLog.networking, object:downloader ) | |
let address = unsafeBitCast(self, to: UInt.self) | |
let addressString = String(address) | |
os_signpost(.begin, log: SignpostLog.networking, name: "Background Image", signpostID: signpostID, "Image name:%{public}@,Caller:%{public}@", book?.title ?? "",addressString) | |
downloader.download(url: book?.imageLinks?.thumbnail ?? "") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func prepareForReuse() { | |
super.prepareForReuse() | |
bookImage?.image = UIImage(named: "placeholder") | |
if let downloaderinProgress = runningDownloader { | |
let signpostID = OSSignpostID (log: SignpostLog.networking, object:downloaderinProgress ) | |
downloaderinProgress.Cancel() | |
os_signpost(.end, log: SignpostLog.networking, name: "Background Image", signpostID: signpostID, "Status:%{public}@,Size:%llu", "Canceled", 0) | |
runningDownloader = nil | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func downloadComplate(downloader: ImageDownloader, data: Data?, error: Error?) { | |
let signpostID = OSSignpostID (log: SignpostLog.networking, object:downloader ) | |
var dataSize: Int64 = 0 | |
if let data = data , error == nil { | |
bookImage?.image = UIImage(data: data) | |
book?.image = UIImage(data: data) | |
dataSize = Int64(data.count) | |
} | |
os_signpost(.end, log: SignpostLog.networking, name: "Background Image", signpostID: signpostID, "Status:%{public}@,Size:%llu", "Completed", dataSize) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
func os_signpost(_ type: OSSignpostType, dso: UnsafeRawPointer = #dsohandle, log: OSLog, name: StaticString, signpostID: OSSignpostID = .exclusive) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
final class SignpostLog { | |
static let networking = OSLog(subsystem: "com.yuvedha.booksapp", category: "Networking") | |
static let pointOFInterest = OSLog(subsystem: "com.yuvedha.booksapp", category: .pointsOfInterest) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidAppear(_ animated: Bool) { | |
os_signpost(.event, log: SignpostLog.pointOFInterest, name: "Details Appeared", "%{public}@", book?.title ?? "") | |
} |