/SwiftyBeaver

Convenient logging during development & release in Swift 2 & 3

Primary LanguageSwiftMIT LicenseMIT

SwiftyBeaver
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)

----

During Development: Colored Logging to Xcode Console

Learn more about colored logging to Xcode Console.


During Development: Colored Logging to File

Learn more about logging to file.


On Release: Encrypted Logging to SwiftyBeaver Platform

Learn more about logging to the SwiftyBeaver Platform during release.


Browse, Search & Filter via Mac App

swiftybeaver-demo1

Signup to private beta to get your development & release logs into the free Mac App.


Installation

You can use Carthage to install SwiftyBeaver by adding that to your Cartfile:

github "SwiftyBeaver/SwiftyBeaver"

via CocoaPods

To use CocoaPods just add this to your Podfile:

pod 'SwiftyBeaver'

via Swift Package Manager (Swift 2.2)

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)
]
)

Usage

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"])


Documentation

Getting Started:

Logging Destinations:

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.