Git Product home page Git Product logo

nayau's Introduction

#Nayau A production/debug logger for you Swift Project

Requirements

  • iOS 9.0
  • Xcode 7.1+

Instalation

Embedded frameworks require a minimum deployment target of iOS 8 or OS X Mavericks (10.9).

Carthage

github "elo7/nayau" "master"

And add the path to the framework under “Input Files”, e.g.:

$(SRCROOT)/Carthage/Build/iOS/nayau.framework

Getting started

First of all, you shall setup your debug/release flags, it's quite simple. "Set it in the Swift Compiler - Custom Flags section, 'Other Swift Flags' line. Just Add -D DEBUG. If you are having problems with that, look that Stack Overflow question.

And paste that code block in your setup area, it's the simple way that we found to know if your applications is in debug or release mode.

func isDebug() -> Bool {
    #if DEBUG
        return true
    #else
        return false
    #endif
}

Finally you can setup your Nayau:

import nayau

Nayau.setup(debugBuild: YourClass().isDebug())

Nayau.debug("A debug message")
#=> A debug message 

Nayay.debug("A error message in debug mode", logType: LogType.Error)
#=> [Error] : A error message in debug mode

Nayau.production("A production message")
#=> A production message 

Nayau.production("A error message in production mode", logType: LogType.Error) {
#=> [Error] : A error message in production mode

Enable file information

If you want to see file that logging information, just enable that in the Nayau setup method:

import nayau

Nayau.setup(enableFileName: true, debugBuild: YourClass().isDebug())

Nayau.debug("A debug message")
#=> A debug message FileInformation: File: yourPath/YourFile.swift Line Number: 61 Function: xablau()

Nayau.production("A production message")
#=> A production message FileInformation: File: yourPath/YourFile.swift Line Number: 61 Function: xablau()

Compute information in Debug

If you want to compute something heavy to process, you can use Nayau with trailing closure, and that heavy compute will execute just in debug:

Nayau.debug {
    let xablau = [ "this" , "message" , "concat" , "is" , "just" , "necessary" , "in" , "debug" , "mode" ]

    return xablau.map {
        $0.uppercaseString
    }
}

Why Nayau?

Sometimes, we (developers) need to debug our developing applications, with that in mind, we built a simple tool that can help you with your debug/production log. When you need to print some information/data just for test/follow flow of your application, use debug instance method from Nayau, when you need to print something in released apps, use production instance method from Nayau. Quite simple :)

Contribute

  • If you found a bug, open an issue.
  • If you have a feature request, open an issue.
  • If you want to contribute, submit a pull request

License

Nayau is released under the MIT license. See LICENSE for details.

nayau's People

Contributors

aterribili avatar fernandes456 avatar

Watchers

Jiayang Miao 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.