GithubHelp home page GithubHelp logo

marinehero / qorumlogs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from esqarrouth/qorumlogs

0.0 2.0 0.0 97 KB

Swift Logging Utility for Xcode & Google Docs

License: MIT License

Swift 100.00%

qorumlogs's Introduction

QorumLogs

Swift Logging Utility in Xcode & Google Docs

Created while working on Qorum app (Hacker News For iOS Startups).

##Log Levels

class MyAwesomeViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        QL1Debug("Debug")
        QL2Info("Info")
        QL3Warning("Warning")
        awesomeFunction()
    }
    func awesomeFunction() {
        QL4Error("Error")
        QL5Severe("Severe")
    }
}

demo




##Works for both night mode and lightmode

demo


##Autocomplete Friendly: Type 2 Letters

-demo


##Filter File Specific Logs: Paste this where QorumLogs is initiliazed:

  QorumLogs.onlyShowThisFile(NewClass)

demo


##Google Docs Support:

In production, send all your logs to Google Docs with only 1 line of extra code.

  QorumLogs.enabled = false
  QorumOnlineLogs.enabled = true

demo




##Spot System Logs: System logs are white (or black) after all, yours are not :)

demo

##Installation (~2 minutes)

  1. Download and drop 'QorumLogs.swift' in your project. (Cocoapods forces you to import the framework in everyline. If anyone has a solution or workaround, inform me please)
  2. If you don't have Alcatraz or XcodeColors installed, lets install them. Open up your terminal and paste this:
curl -fsSL https://raw.github.com/supermarin/Alcatraz/master/Scripts/install.sh | sh
  1. Restart Xcode after the installation
  2. Alcatraz requires Xcode Command Line Tools, which can be installed in Xcode > Preferences > Downloads. (You might not need this in the latest Xcode version)
  3. In Xcode click Window > Package Manager, type in 'XcodeColors' in the search bar. Click Install.
  4. Restart Xcode after the installation
  5. In your AppDelegate or anywhere else enter this:
QorumLogs.enabled = true
QorumLogs.test()
  1. You will see something this:

demo

Congratulations!

##Log Storage in GoogleDocs (Optional, ~4 minutes) [Learn to integrate GoogleDocs](./Log To GoogleDocs.md)

##Detailed Features:

####Log Levels

Sets the minimum log level that is seen in the debug area:

  1. Debug - Detailed logs only used while debugging
  2. Info - General information about app state
  3. Warning - Indicates possible error
  4. Error - An unexpected error occured, its recoverable
  5. Severe - Serious error, likely to crash now
  QorumLogs.minimumLogLevelShown = 2
  QorumOnlineLogs.minimumLogLevelShown = 4 // Its a good idea to have OnlineLog level a bit higher
  QL1Debug("mylog") // Doesn't show this level anywhere, because minimum level is 2
  QL2Info("mylog")  // Shows this only in debugger
  QL3Warning("mylog") // Shows this only in debugger
  QL4Error("mylog") // Shows this in debugger and online logs
  QL5Severe("mylog") // Shows this in debugger and online logs

QL methods can print in both Debugger and Google Docs, depending on which is active.

####Hide Other Classes

You need to write the name of the actual file, you can do this by a string and also directly the class name can be appropriate if it is the same as the file name. Add the following code where you setup QorumLogs:

  QorumLogs.onlyShowThisFile(MyAwesomeViewController)
  QorumLogs.onlyShowThisFile("MyAwesomeViewController")

You do not need the extension of the file.

####Print Lines

  QLPlusLine()
  QL2Info("Text between line")
  QLShortLine()

demo

####OnlineLogs - User Information

   QorumOnlineLogs.extraInformation["userId"] = "sfkoFvvbKgr"
   QorumOnlineLogs.extraInformation["name"] = "Will Smith"
   QL1Debug("Will is awesome!")
   QL5Severe("Will rules!")

demo

You only need to set the extraInformation one time. ##FAQ

How to delete rows inside google docs?

Unfortunately you can't just select the rows inside Google Docs and delete them. You need to select the rows where there are row numbers, then right click, then press delete click "Delete rows x-y" http://i.imgur.com/0XyAAbD.png

##Requirements

  • Xcode 6 or later (Tested on 6.4)
  • iOS 7 or later (Tested on 7.1)

##Possible features

  • Different colors for white and black Xcode themes
  • Easily editable colors
  • Device information to Google Docs
  • Google Docs shows in exact order
  • Automaticly getting entry ids for Google Docs
  • Pod support with QL methods written customly

##Thanks for making this possible

##License QorumLogs is available under the MIT license. See the LICENSE file.

##Keywords Debugging, logging, remote logging, remote debugging, qorum app, swift log

qorumlogs's People

Contributors

esqarrouth avatar thellimist avatar

Watchers

James Pereira avatar James Cloos 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.