To run the example project, clone the repo, and run pod install
from the Example directory first.
CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:
$ gem install cocoapods
CocoaPods 1.1+ is required to build TimberiOS.
To integrate TimberiOS into your Xcode project using CocoaPods, specify it in your Podfile
:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '9.0'
use_frameworks!
target '<Your Target Name>' do
pod 'TimberiOS'
end
Then, run the following command:
$ pod install
-
dt
-
level
-
severity
-
message
-
tags
-
runtime (
application - class-name
) -
time_ms
-
context
-
organization
-
platform (logged in
runtime - applcation - class-name
) -
release
-
runtime (only
application - class-name
(see above) ) -
session
-
source
-
system
-
user
-
event
-
custom
-
error
-
More ...
The level defined here are the ones defined in Timber
public enum LogLevel: String { case debug = "debug" case info = "info" case notice = "notice" case warn = "warn" case error = "error" case critical = "critical" case alert = "alert" case emergency = "emergency" }
The type defined here are the ones defined in Timber
public enum LogType: String { case frame = "/frames" case alert = "/alert" }
The severity is the level of severity of the log. As defined in Timber, it must be between 0 and 7. The app will crash if the severity is higher or lower.
AppDelegate.swift :
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. TimberLogger.initialize(with: "YOUR_TIMBER_API_KEY", internalLogLevel: .InternalLogLevel) return true }
This enum is here to help your console dealing with logs. It will only print logs when the LogLevel is >= than the InternalLogLevel
public enum InternalLogLevel: String { case debugInternal case warnInternal case criticalInternal } private static let debugLevelArray: [LogLevel] = [.debug, .info, .notice, .warn, .error, .critical, .alert, .emergency] private static let warnLevelArray: [LogLevel] = [.warn, .error, .critical, .alert, .emergency] private static let criticalLevelArray: [LogLevel] = [.critical, .alert, .emergency]
AppDelegate.swift :
override func viewDidLoad() { super.viewDidLoad() TimberLogger.shared.log(type: .frame, level: .info, severity:2, tags:[], message: "viewDidLoad") // Do any additional setup after loading the view, typically from a nib. }
Nicolas Charvoz, charvoz.nicolas@gmail.com
You can create your account and get your own API key on : Timber.io
TimberiOS is available under the MIT license. See the LICENSE file for more info.