Colorful, extensible, lightweight logging for Swift 2 & 3.
Great for development & release with support for Console, File & cloud platforms.
NEW: Log during release to the conveniently built-in SwiftyBeaver Platform and Mac App!
Docs |
Website |
Slack |
Twitter |
License
[![Language Swift 2](https://img.shields.io/badge/Language-Swift%202-orange.svg)](https://developer.apple.com/swift) [![Travis Build Status](https://travis-ci.org/SwiftyBeaver/SwiftyBeaver.svg?branch=master)](https://travis-ci.org/SwiftyBeaver/SwiftyBeaver) [![Slack Status](https://slack.swiftybeaver.com/badge.svg)](https://slack.swiftybeaver.com)
----
Learn more about colored logging to Xcode Console.
Learn more about logging to file.
Learn more about logging to the SwiftyBeaver Platform during release.
Signup to private beta to get your development & release logs into the free Mac App.
You can use Carthage to install SwiftyBeaver by adding that to your Cartfile:
github "SwiftyBeaver/SwiftyBeaver"
To use CocoaPods just add this to your Podfile:
pod 'SwiftyBeaver'
To use SwiftyBeaver as a Swift Package Manager package just add the following in your Package.swift file.
import PackageDescription
let package = Package(
name: "HelloWorld",
dependencies: [
.Package(url: "https://github.com/SwiftyBeaver/SwiftyBeaver.git", majorVersion: 0)
]
)
Add that near the top of your AppDelegate.swift
to be able to use SwiftyBeaver in your whole project.
import SwiftyBeaver
let log = SwiftyBeaver.self
At the the beginning of your AppDelegate:didFinishLaunchingWithOptions()
add the SwiftyBeaver log destinations (console, file, etc.) and then you can already do the following log level calls globally (colors included):
// add log destinations. at least one is needed!
let console = ConsoleDestination() // log to Xcode Console
let file = FileDestination() // log to default swiftybeaver.log file
let cloud = SBPlatformDestination(appID: "foo", appSecret: "bar", encryptionKey: "123") // to cloud
log.addDestination(console)
log.addDestination(file)
log.addDestination(cloud)
// Now let’s log!
log.verbose("not so important") // prio 1, VERBOSE in silver
log.debug("something to debug") // prio 2, DEBUG in green
log.info("a nice information") // prio 3, INFO in blue
log.warning("oh no, that won’t be good") // prio 4, WARNING in yellow
log.error("ouch, an error did occur!") // prio 5, ERROR in red
// log anything!
log.verbose(123)
log.info(-123.45678)
log.warning(NSDate())
log.error(["I", "like", "logs!"])
log.error(["name": "Mr Beaver", "address": "7 Beaver Lodge"])
Getting Started:
Logging Destinations:
- Colored Logging to Xcode Console
- Colored Logging to File
- Encrypted Logging & Analytics to SwiftyBeaver Platform
Stay Informed:
More destination & system documentation is coming soon!
Get support via Github Issues, email and public Slack channel.
## License
SwiftyBeaver Framework is released under the MIT License.