Created
December 4, 2018 21:38
-
-
Save ozgurodabasi/dc74d40bdc508ff18cf4644a390ccbd8 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import os.log | |
import Foundation | |
let oslog = Log() | |
struct Log { | |
func info<T>(_ object: T, _ file: String = #file, _ function: String = #function, _ line: Int = #line) { | |
if AppConfig.loggingEnabled { | |
let fileName: String = (NSURL(string: file)?.lastPathComponent)! | |
let infoString: String = " π -> \(fileName):\(function):[\(line)]: \(object)" | |
os_log(">> %{public}@", infoString) | |
} | |
} | |
func error<T>(_ object: T, _ file: String = #file, _ function: String = #function, _ line: Int = #line) { | |
if AppConfig.loggingEnabled { | |
let fileName: String = (NSURL(string: file)?.lastPathComponent)! | |
let infoString: String = " πβ ERROR -> \(fileName):\(function):[\(line)]: \(object)" | |
os_log(">> %{public}@", infoString) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment