Code Monkey home page Code Monkey logo

swiftybeaver's Introduction

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.

swiftybeaver's People

Contributors

alexpersian avatar dashutch avatar davidrothera avatar ewanmellor avatar fvvliet avatar irace avatar manuelvanrijn avatar mariusciocanel avatar muukii avatar narsail avatar prenagha avatar reesemclean avatar skreutzberger avatar vdka avatar wvdk avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.