Coder Social home page Coder Social logo

yalconsole's Introduction

Yalantis

YALConsole v1.0

YALConsole is handy and flexible logging utility that integrates into your iOS project. It may be useful to QA engineers that usually do not have access to debugger. Besides custom logging you can add counters, observers and actions.

Requirements

  • iOS 7.0 or later
  • ARC

Integration

  • Downolad YALConsole.
  • Add YALConsole.framework and YALConsole.bundle to the project.
  • Console requires FBKVOController that can be downloaded here.
  • Add -all_load flag to Other Compiler Flags in Build Settings.
  • Import header: #import "YALConsole/YALConsole.h".

Installation with CocoaPods:

Add following to your podfile:

pod 'YALConsole', :git => "https://github.com/Yalantis/YALConsole"

Usage

Console instantiates on first call. You can do that at any point of your app from any thread. After instantiation console is available by two-finger tap gesture. It consists of two tabs: ‘Console’ as it is and ‘Dashboard’.

Console

Following code is similar to NSLog, it throws text message into console.

YALog(@"Hello, console!");

Unlike NSLog, output contains information about thread, class, method an line of code where call happens. Tap output cell on ‘Console’ tab to see additional info.

Dashboard

There are three types of items can be placed on the Dashboard: observers, counters and actions.

###Observer

Adding observer item you get ability to watch for value for key path using KVO.

[YALConsole addObserverOf:self keyPath:@"user.name" forIdentifier:@"Name"];

Identifier is mandatory for each Dashboard Item. It defines uniquity of item and allows to remove object from the Dashboard when you don’t need it anymore.

Observer highlights potentially invalid values: null and nil. Click the item to see history of values of observed variable. Buttons at the bottom of the screen are ‘Clear’, ‘Follow’ and ‘Freeze’. Switching ‘Follow’ off allows you to scroll list even when data updates dynamically. Freezing temporarily unsubscribes list from history updates.

###Counter

Counter works almost similar to observer, but incrementing is up to you. Counter’s values history is also available by click. Adding and incrementing Counter Item:

[YALConsole addCounterForIdentifier:@"Steps"];
[YALConsole incrementCounterForIdentifier:@"Steps"];

###Action

Action Items is a button on the Dashboard that is assigned execution of specified block. This can be handy for specific actions like Keychain clearing.

[YALConsole addAction:^{NSLog(@"Bang!");} forIdentifier:@"Make some noise"];

And don’t forget of retain cycles!

Call Stack Symbols

Click a value on the History screen to see call stack that led to current value assignment. You will also find thread’s identifier there. Tap the icon at the the bottom of the screen to copy all the info into Pasteboard.

Items removal

You can delete item by identifier:

[YALConsole removeItemForIdentifier:@"Steps"];

Or clear whole Dashboard:

[YALConsole removeAllItems];

Setup

Set the history limit with this:

[YALConsole setHistoryLimit:200];

Notice that history doesn’t store values. That would make impact on app’s performance or even lead to inconsistency. So history just keeps description strings. In order to avoid interference with gestures used in your application, you can set the number of taps required to show console:

[YALConsole setNumberOfTouchesRequired:3];

Contact

Follow our blog at yalantis.com

Maintainers

Aleksey Chernish

License

YALConsole is available under the MIT license. See the LICENSE file for more info.

yalconsole's People

Contributors

maximletushov avatar mmrmmlrr avatar

Watchers

 avatar  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.