GithubHelp home page GithubHelp logo

gtsouza / loggingprint Goto Github PK

View Code? Open in Web Editor NEW

This project forked from junglecandy/loggingprint

0.0 2.0 0.0 7 KB

Swift 3 logging only when in Debug mode.

License: MIT License

Swift 100.00%

loggingprint's Introduction

LoggingPrint

Swift convenience functions for outputting to the console only when the build setting for "Active Complilation Conditions" (SWIFT_ACTIVE_COMPILATION_CONDITIONS) defines DEBUG

Two methods are provided.

  • loggingPrint() stands in for the print() function.
  • loggingDump() stands in for the dump() function.

For loggingPrint() the textual representation is obtained from the object using String(reflecting:) which works for any type. To provide a custom format for the output make your object conform to CustomDebugStringConvertible and provide your format in the debugDescription parameter.

For loggingDump() pass in the value to be dumped, and an optional string to act as a label that describes what is being dumped

Through the magic of default function parameter values, the output for each function contains:

  • Whether the call is being made on the UI or a background thread.
  • The name of the file.
  • The name of the function
  • The line number where the print statement is located.

Requirements

The latest version requires Swift 3.x and Xcode 8.

Usage

The same way as you would use a print() statement, or a dump() statement.

Installation

Just add the file to your project, and define DEBUG in your project's Active Complilation Conditions setting.

OR if you are using Carthage add this to your Cartfile

github "JungleCandy/LoggingPrint" >= 2.0

then drag the LoggingPrint.swift file out of the Checkouts folder and into your project.

loggingprint's People

Contributors

abizern avatar

Watchers

Gabriel Tavares de Souza 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.