Giter VIP home page Giter VIP logo

timberjack's Introduction

#Timberjack

Automatic Swift network activity logger for iOS or OSX.

CocoaPods Carthage compatible MIT iOS

Timberjack is a simple, unintrusive network activity logger. Log every request your app makes, or limit to only those using a certain URLSession if you'd prefer. It also works with Alamofire, if that's your thing.

  • Enable logging across your app with just 1 line of code
  • Verbose and Light debugging modes
  • Works with URLSession, URLConnection, Alamofire and pretty much any networking framework
  • Pretty printed JSON responses
  • Useful for debugging and development, but probably best not to ship your app with verbose logging.

##Installation

Timberjack is installed as an embedded framework, and as such requires at least iOS8. If you require iOS7 compatibility, simply drag the Timberjack.swift file into your own project.

###CocoaPods

Add the following to your Podfile

platform :ios, '8.0'
use_frameworks!

pod 'Timberjack'

Then install with pod install

###Carthage

Add the following to your Cartfile

github "andysmart/Timberjack" >= 0.0.3

##Usage

Nice and easy, just register when your app loads, and Timberjack will monitor and log any requests you make via URLSession or URLConnection.

import UIKit
import Timberjack

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    var window: UIWindow?

    func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
        Timberjack.register() //Register Timberjack to log all requests

        return true
    }
}

###Using with Alamofire

Due to the way Alamofire uses NSURLSession, you'll need to do a little more than the standard installation to monitor all requests. The simplest way to do this is to create a subclass of Manager to handle your requests, then just use this in place of Alamofire.request().

import Alamofire
import Timberjack

class HTTPManager: Alamofire.SessionManager {
    static let shared: HTTPManager = {
        let configuration = Timberjack.defaultSessionConfiguration()
        let manager = HTTPManager(configuration: configuration)
        return manager
    }()
}

###Configuration

Timberjack has two modes: Verbose and Light. The default style is verbose. To change this, just set it appropriately.

Timberjack.logStyle = .verbose //Either .Verbose, or .Light

##License

MIT, see LICENSE for details.

##Bugs or Issues

Open an issue here, or ping me a message on Twitter. Even better, fork this repo and open a pull-request!

Unfortunately, due to a limitation in URLProtocol, Timberjack is unable to log the HTTP body of a request, see This radar for more details

##Credits

Built by @andyjsmart

timberjack's People

Contributors

andysmart avatar readmecritic avatar andrewjackman avatar szehnder avatar

Watchers

Florent Alexandre 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.