Swift Logging Utility for Xcode & Google Docs

Related tags

Logging QorumLogs
Overview

QorumLogs

Cocoapods Compatible Carthage compatible

Swift Logging Utility in Xcode & Google Docs

Log Levels

class MyAwesomeViewController: UIViewController {
    override func viewDidLoad() {
        super.viewDidLoad()
        QL1("Debug")
        QL2("Info")
        QL3("Warning")
        awesomeFunction()
    }
    func awesomeFunction() {
        QL4("Error")
    }
}

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

Prerequisites

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

Install via Cocoapods

You can use Cocoapods to install QorumLogs by adding it to your Podfile:

platform :ios, '8.0' # platform :tvos, '9.0' (for tvOS)
use_frameworks!

pod 'QorumLogs' #Stable release for Swift 3.0

pod 'QorumLogs', :git => 'https://github.com/goktugyil/QorumLogs.git' #Latest release for Swift 3.0
pod 'QorumLogs', :git => 'https://github.com/goktugyil/QorumLogs.git', :branch => 'Swift2.3' #For Swift 2.3
pod 'QorumLogs', '~> 0.8' #For Swift 2.2

(Cocoapods forces you to import the framework in every file. If anyone has a solution or workaround, inform me please)

Install via Carthage

You can install QorumLogs via Carthage by adding the following line to your Cartfile:

github "goktugyil/QorumLogs"

Install Manually

Download and drop 'QorumLogs.swift' in your project.

Check Installation Works Correctly

  1. In your AppDelegate or anywhere else enter this: (If Cocoapods or Carthage you must add import QorumLogs)
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
  QorumLogs.minimumLogLevelShown = 2
  QorumOnlineLogs.minimumLogLevelShown = 4 // Its a good idea to have OnlineLog level a bit higher
  QL1("mylog") // Doesn't show this level anywhere, because minimum level is 2
  QL2("mylog")  // Shows this only in debugger
  QL3("mylog") // Shows this only in debugger
  QL4("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()
  QL2("Text between line")
  QLShortLine()

demo

Add Custom Colors

Add custom colors for Mac, iOS, tvOS:

    QorumLogs.colorsForLogLevels[0] = QLColor(r: 255, g: 255, b: 0)
    QorumLogs.colorsForLogLevels[1] = QLColor(red: 255, green: 20, blue: 147)
    QL1("Mylog")

demo

OnlineLogs - User Information

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

demo

You only need to set the extraInformation one time.

KZLinkedConsole support:

KZLinkedConsole is a plugin for Xcode which add clickable link to place in code from log was printed. All you need to do is install it. For more information go to https://github.com/krzysztofzablocki/KZLinkedConsole

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)
  • tvOS 9 or later

Possible features

  • Different colors for white and black Xcode themes
  • Easily editable colors
  • Device information to Google Docs
  • Google Docs shows in exact order
  • Automatically 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, library, framework, tool, google docs, google drive, google forms

Comments
  • Added Xcode project for iOS framework

    Added Xcode project for iOS framework

    An Xcode project was added to provide a framework for iOS, which can be imported easily into other projects. It may be necessary to modify the project to allow it being added to OS X or tvOS projects. This may also affect the podspec file.

    opened by sundance2000 6
  • Renamed log levels and added Xcode project for iOS framework

    Renamed log levels and added Xcode project for iOS framework

    Hi,

    I really like the QorumLogs and use it now in my projects. The only thing, which bothers me, is the naming of the logging functions. To my opinion, function names should be descriptive like "QLogError" and should not contain just three characters like "QL4". This improves the readability of code and makes it easier to identify the log level by name. Maybe you agree and want to add this to your code.

    I also like to make frameworks out of external code, so it can be reused in other projects without copying the source files into the project. I know this can also be done with CocoaPods and you already provide a podspec file. But currently, this system still seems very unstable to me and I want to control code and frameworks by myself. Hence, I also added a minimal Xcode project to provide a framework for iOS. I hope I set the bundle identifier and the project settings correctly. I hope you like the idea of the framework and add it to your repository.

    Thank you for your time and your good work. Kind Regards, Christian

    opened by sundance2000 4
  • Console output is broken

    Console output is broken

    First I installed Alcatraz, went smoothly, then I restarted Xcode. Then, I executed:

        func application(application: UIApplication, willFinishLaunchingWithOptions launchOptions: [NSObject : AnyObject]?) -> Bool {
    
            QorumLogs.enabled = true
            QorumLogs.test()
    

    Instead nicely formatted, colorful output I'm getting this in the console:

     g120,120,120;QorumLogs.test()[91]:[; g0,180,180;Debug[;
     g120,120,120;QorumLogs.test()[92]:[; g0,150,0;Info[;
     g120,120,120;QorumLogs.test()[93]:[; g255,190,0;Warning[;
     g120,120,120;QorumLogs.test()[94]:[; g255,0,0;Error[;
    
    opened by r3econ 4
  • Update README to declare Carthage compatibility (+ installations instructions)

    Update README to declare Carthage compatibility (+ installations instructions)

    Here you go 😃

    ⚠️ Carthage automatically fetches the last tagged release when the user doesn't specify a branch or anything else (which is the default case) so the installation instructions don't work without a new release. It would be awesome if you would provide a new release 🚀

    In the meantime you can point Carthage to the latest commit by using

    github "goktugyil/QorumLogs" "master"
    

    Thank you!

    opened by floriankrueger 3
  • iOS 7.3 compatibility

    iOS 7.3 compatibility

    Is it just me or QorumLogs is not iOS 9.3 ready? Instead of getting colourful output I get white text which looks like this:

    [fg120,120,120;LoginViewController.swift:87 launchApplication():[; g0,150,0;

    I have to admit I just updated my devices and Xcode today..

    opened by staticdreams 3
  • Allow to show only logs from an array of files

    Allow to show only logs from an array of files

    Make possible to pass an array of files instead of only one file. I replaced the generic type with Any because it didn't seem to do anything, and it was also causing problems with the array.

    The names have to be passed using either strings or MyType.self. The array doesn't work only with MyType. The old method works normally and it's still possible to pass MyType.

    I also moved classStringWithoutPrefix in the AnyObject block, because there were problems with structs, where the name is not prefixed.

    opened by ivanschuetz 3
  • KZLinkedConsole support

    KZLinkedConsole support

    Hi! Install plugin KZLinkedConsole throw Alcatraz. If I set QorumLogs.KZLinkedConsoleSupportEnabled = true, I got error "Type 'QorumLogs' has no member 'KZLinkedConsoleSupportEnabled" What I'm doing wrong ?

    opened by kiokumicu 3
  • Print logs only in Debug mode

    Print logs only in Debug mode

    I am working on an application which needs to spit logs only when application is run in the debug mode and want to eliminate any logs when in release. Is it possible to customize that way. Even better, for every log I am trying to print, is it possible to specify if I want to print that log in release or not?

    opened by jayesh15111988 2
  • Swift3.0 support

    Swift3.0 support

    Hi, I am very like this framework.But now out projects already converted to swift3.0 with Xcode8, so we can not use it.Can you make the framework to support swift3.0 or create a swift3.0 beta branch. Thanks.

    opened by SteveJKing 2
  • Xcode 8 support

    Xcode 8 support

    Hello! Thanks your great job to make my coding life colourful. I am trying my project with Xcode 8 now. Is there any plan to support Xcode 8 with coloured logging?

    opened by billchanmagic 2
  • Error post cocapods installtion

    Error post cocapods installtion

    Hey,

    I have been trying to use QorumLogs for a project of mine and I installed using cocoapods(0.39.0). After install when I try to build the project I get following errors.

    screen shot 2016-05-12 at 3 47 11 pm

    Following are the content of my cocoapods file

    target 'MyApp' do
      source 'https://github.com/CocoaPods/Specs.git'
      platform :ios, '8.0'
      use_frameworks!
      pod 'Alamofire', '~> 3.1.3'
      pod 'SwiftyJSON', :git => 'https://github.com/SwiftyJSON/SwiftyJSON.git'
      pod 'QorumLogs'
    end
    

    I am really sorry if its a basic issue I am new to iOS development

    opened by r0h1t4sh 2
  • Logs on log file

    Logs on log file

    Add a functionality that we can add the logs directly to a text file that can be store in documents directory or cache directory. This file can be used to send report to the developer in case of any issues

    opened by vaibhav-varshaaweblabs 3
  • QLManager performance issues

    QLManager performance issues

    When you do big loops, like 10k for loops some line in here is lagging the whole code. I think it might be the file extensions.

        for _ in 0..<10000 {
          QL1(11111)
       }
    
    bug 
    opened by goktugyil 2
  • Add support for batch sending logs

    Add support for batch sending logs

    Sending dozens and dozens of logs per session seems like wasted overhead. I'd prefer to store logs throughout the user's session, then send the stored logs in a single request the next time the user foregrounds the app (or possibly attempt to send them when the user backgrounds the app). This would remove the wasted overhead associated with numerous smaller HTTP requests (headers). You would definitely need local persistence of some kind. I'd also like to know that things like logs couldn't potentially be slowing down other HTTP requests that are actually critical - this is particularly a concern on mobile devices in limited bandwidth conditions.

    opened by camclendenin 1
  • Ability to Set Log Levels Per File

    Ability to Set Log Levels Per File

    This can be tagged as a feature request.

    I wrote a wrapper for Qorum that does a few things I wish Qorum did. Perhaps some inspiration can be drawn from it for future changes. For example, setting onlyShowThisFile or minimumLogLevelShown should use the same prefix format for other log events so they can be tracked to a line number.

    https://gist.github.com/semireg/66a127b6ae940984738e84334af84357

    While minimumLogLevelShown is useful, one missing feature is the ability to set different levels for each file. That way, a global can be set such as ERROR and then developers can turn on debugging on a per-file basis.

    Thoughts?

    opened by semireg 1
Owner
Goktug Yilmaz
World-class code copy paster.
Goktug Yilmaz
JustLog brings logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support for logz.io available.

JustLog JustLog takes logging on iOS to the next level. It supports console, file and remote Logstash logging via TCP socket with no effort. Support f

Just Eat 509 Dec 10, 2022
Twitter Logging Service is a robust and performant logging framework for iOS clients

Twitter Logging Service Background Twitter created a framework for logging in order to fulfill the following requirements: fast (no blocking the main

Twitter 290 Nov 15, 2022
Logging utility for Swift and Objective C

Swell - Swift Logging A logging utility for Swift and Objective C. ##Features Turn on logging during development, turn them off when building for the

Hubert Rabago 361 Jun 29, 2022
Spy is a flexible, lightweight, multiplatform logging utility written in pure Swift.

Spy is a flexible, lightweight, multiplatform logging utility written in pure Swift. It allows to log with different levels and on different channels. You can define what levels and channels actually are.

AppUnite Sp. z o.o. Spk. 12 Jul 28, 2021
Convenient & secure logging during development & release in Swift 3, 4 & 5

Colorful, flexible, lightweight logging for Swift 3, Swift 4 & Swift 5. Great for development & release with support for Console, File & cloud platfor

SwiftyBeaver 5.6k Jan 4, 2023
CleanroomLogger provides an extensible Swift-based logging API that is simple, lightweight and performant

CleanroomLogger CleanroomLogger provides an extensible Swift-based logging API that is simple, lightweight and performant. The API provided by Cleanro

null 1.3k Dec 8, 2022
Willow is a powerful, yet lightweight logging library written in Swift.

Willow Willow is a powerful, yet lightweight logging library written in Swift. Features Requirements Migration Guides Communication Installation Cocoa

Nike Inc. 1.3k Nov 16, 2022
A lightweight logging framework for Swift

HeliumLogger Provides a lightweight logging implementation for Swift which logs to standard output. Features Logs output to stdout by default. You can

Kitura 174 Nov 30, 2022
A lightweight logging framework for Swift

HeliumLogger Provides a lightweight logging implementation for Swift which logs to standard output. Features Logs output to stdout by default. You can

Kitura 174 Nov 30, 2022
TraceLog is a highly configurable, flexible, portable, and simple to use debug logging system for Swift and Objective-C applications running on Linux, macOS, iOS, watchOS, and tvOS.

Please star this github repository to stay up to date. TraceLog Introduction TraceLog is a highly configurable, flexible, portable, and simple to use

Tony Stone 52 Oct 28, 2022
A flexible logging library written in Swift

Puppy Puppy is a flexible logging library written in Swift ?? It supports multiple transports(console, file, syslog, and oslog) as loggers. It not onl

Koichi Yokota 92 Dec 29, 2022
An extensible logging framework for Swift

Log is a powerful logging framework that provides built-in themes and formatters, and a nice API to define your owns. Get the most out of Log by insta

Damien 825 Nov 6, 2022
A powerful input-agnostic swift logging framework made to speed up development with maximum readability.

The Swift logging framework. Atlantis is an extremely powerful logging framework that I've created for everyday use, including enterprise development

Andrew Aquino 199 Jan 2, 2023
Most natural Swift logging

Evergreen Most natural Swift logging Evergreen is a logging framework written in Swift. It is designed to work just as you would expect, yet so versat

Nils Leif Fischer 72 Aug 12, 2022
Simple, lightweight and flexible debug logging framework written in Swift

AELog Simple, lightweight and flexible debug logging minion written in Swift If you find yourself in upcoming statements, then you probably want to us

Marko Tadić 28 Jul 6, 2022
A simple logging package for Swift

OhMyLog OhMyLog is a simple logging package for Swift. It supports the following features: Six logging levels ( ?? , ?? , ?? , ⚠️ , ?? , ?? ) Display

Junhao Wang 1 Jan 10, 2022
Simple logging for simples needs.

Simple logging for simples needs.

native.dev.br 0 May 30, 2022
Class for logging excessive blocking on the main thread

Watchdog Class for logging excessive blocking on the main thread. It watches the main thread and checks if it doesn’t get blocked for more than define

Wojtek Lukaszuk 1.8k Dec 6, 2022
In-App iOS Debugging Tool With Enhanced Logging, Networking Info, Crash reporting And More.

The debugger tool for iOS developer. Display logs, network request, device informations, crash logs while using the app. Easy accessible with its bubble head button ?? . Easy to integrate in any apps, to handle development or testing apps easier. First version, there is plenty of room for improvement.

Remi ROBERT 1.8k Dec 29, 2022