βββββββββββββββββββ βββββββββββββββββββ βββββ¦β¦βββ¦βββ£ββββββ£βββββββ¦βββ¦βββ¦βββ¦ββ βββββ β£ββββββββββββββββ£ββββββββββββ£ββ ββββββββββββββ£ββββββββββββββββββββ£β βββββ©β©β©β©β£βββ©ββ©ββββ©ββββ©βββ©βββ βββ βββ©β ββββββββββββββββββββββββββββ βββ ββββββββββββββββββββββββββββ©βββ
A simple logger for Swift.
Use Swift Package Manager to add this package to your project.
public static func log(str: String,
appName: String? = nil,
identity: String? = nil,
logToSystem: Bool? = false,
category: LogCategory,
type: OSLogType? = .debug,
log: OSLog? = .default)
str (String): logging message
appName (String): app name to show at log header.
identity (String): name of log.
logToSystem (Bool): parameter for write log in system log console or not. Default is FALSE.
category (enum): the log category options:
public enum LogCategory: String {
case success = "β
β
"
case info = "βΉοΈβΉοΈ"
case warning = "β οΈβ οΈ"
case error = "π§¨π§¨"
case viewcycle = "π±π±"
case data = "ππ"
case service = "π¬π¬"
case trace = "πΈπΈ"
}
type (OSLogType): type of OSLog for system console.
log (OSLog): the log write.
//
import UIKit
import os.log
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
SimplyLogger.log(str: "Testing logging", logToSystem: true, category: .error, type: .error)
}
}
//
import UIKit
import os.log
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
SimplyLogger.trace(str: "view did loaded")
}
}
Also, you can do a complex trace using custom log with "trace" category.
SimplyLogger.log(str: "Testing logging", logToSystem: true, category: .trace, type: .debug)
ROADMAP
- Store logs in BBDD for check and analyze behaviors (CoreData, Realm, SQLite...)
- Retrieve logs sliced in blocks.
- Set limits of number of logs stored.
David Martin Saiz β @deividmarshall β [email protected]
Distributed under the MIT license. See LICENSE
for more information.
https://github.com/CodeNationDev/
link |
Stars: 1 |
Last commit: 2 years ago |
Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics