Latest 0.2.1
Homepage https://github.com/GErakleous/DPrint
License MIT
Platforms ios 10.3
Authors

CI Status
Version
License
Platform

Example

To run the example project, clone the repo, and run pod install from the Example directory first.

Requirements

Installation

DPrint is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod 'DPrint'

and then perform a pod install.

Details

NOTE: EXPERIMENTAL

Small Debug logger written in Swift. It can log the name of the file in which it appears, the name of the declaration and the line number. Different types of logs are supported as well: text = 🔤, debug = 🚥, warning = ⚠️, error = ❌, fixme = 💊.

There is a default ‘DPrint.log’ method which accepts the following arguments:

  • item (Any) -> The item(s) to print.

  • path (String) -> The name of the file in which it appears (optional).

  • functionName (String) -> The name of the declaration in which it appears (optional).

  • lineNo (Int) -> The line number on which it appears (optional).

  • messageType (DPrintMessageType) -> The type of icon to show when printing the message (optional).

    Five more convenient methods have been provided to help distinguish logs based on type (i.e. DPrint.logText, DPrint.logDebug, DPrint.logError, DPrint.logFixMe, DPrint.logWarning). See usage below.

Usage:

In your class:

import DPrint

Then when you want to log something use one of the following methods:

DPrint.log("blah", ["item", "item 1"], ["item": 6, "item2": 8], 9)
DPrint.logText([2, 4], "text")
DPrint.logDebug("A debug message")
DPrint.logError("An error message")
DPrint.logFixMe("Fix me please")
DPrint.logWarning("Please be careful")

The output will be:

File: ViewController.swift | Function: viewDidLoad() | lineNo: 18
-> blah
-> ["item", "item 1"]
-> ["item": 6, "item2": 8]
-> 9
🔤 | File: ViewController.swift | Function: viewDidLoad() | lineNo: 21
-> [2, 4]
🔤 | File: ViewController.swift | Function: viewDidLoad() | lineNo: 21
-> text
🚥 | File: ViewController.swift | Function: viewDidLoad() | lineNo: 22
-> A debug message
❌ | File: ViewController.swift | Function: viewDidLoad() | lineNo: 23
-> An error message
💊 | File: ViewController.swift | Function: viewDidLoad() | lineNo: 24
-> Fix me please
⚠️ | File: ViewController.swift | Function: viewDidLoad() | lineNo: 25
-> Please be careful

Author

George Erakleous, [email protected]

License

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

Latest podspec

{
    "name": "DPrint",
    "version": "0.2.1",
    "summary": "Small Debug logger written in Swift.",
    "description": "NOTE: EXPERIMENTALnnSmall Debug logger written in Swift. It can log the name of the file in which it appears, the name of the declaration and the line number. Different types of logs are supported as well: text = ud83dudd24, debug = ud83dudea5, warning = u26a0ufe0f, error = u274c, fixme = ud83dudc8a.nnThere is a default 'DPrint.log' method which accepts the following arguments:n* #item (Any) -> The item(s) to print.n* #path (String)t-> The name of the file in which it appears (optional).n* #functionName (String) -> The name of the declaration in which it appears (optional).n* #lineNo (Int) -> The line number on which it appears (optional).n* #messageType (DPrintMessageType)t-> The type of icon to show when printing the message (optional).nFive more convenient methods have been provided to help distinguish logs based on type (i.e. DPrint.logText, DPrint.logDebug, DPrint.logError, DPrint.logFixMe, DPrint.logWarning). See usage below.nn## Usage:nnIn your class:nn```Swiftnimport DPrintn```nnThen when you want to log something use one of the following methods:n```SwiftnDPrint.log("blah", ["item", "item 1"], ["item": 6, "item2": 8], 9)nDPrint.logText([2, 4], "text")nDPrint.logDebug("A debug message")nDPrint.logError("An error message")nDPrint.logFixMe("Fix me please")nDPrint.logWarning("Please be careful")n```nnThe output will be:n```nFile: ViewController.swift | Function: viewDidLoad() | lineNo: 18n-> blahn-> ["item", "item 1"]n-> ["item": 6, "item2": 8]n-> 9nud83dudd24 | File: ViewController.swift | Function: viewDidLoad() | lineNo: 21n-> [2, 4]nud83dudd24 | File: ViewController.swift | Function: viewDidLoad() | lineNo: 21n-> textnud83dudea5 | File: ViewController.swift | Function: viewDidLoad() | lineNo: 22n-> A debug messagenu274c | File: ViewController.swift | Function: viewDidLoad() | lineNo: 23n-> An error messagenud83dudc8a | File: ViewController.swift | Function: viewDidLoad() | lineNo: 24n-> Fix me pleasenu26a0ufe0f | File: ViewController.swift | Function: viewDidLoad() | lineNo: 25n-> Please be carefuln```",
    "homepage": "https://github.com/GErakleous/DPrint",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "George Erakleous": "[email protected]"
    },
    "source": {
        "git": "https://github.com/GErakleous/DPrint.git",
        "tag": "0.2.1"
    },
    "platforms": {
        "ios": "10.3"
    },
    "source_files": "DPrint/Classes/**/*",
    "pushed_with_swift_version": "echo "3.0" > .swift-version"
}

Pin It on Pinterest

Share This