1.0.3 • Published 9 years ago

qulog v1.0.3

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

Qulog Build Status

(Quickly Usable Log) "que-log"

A fast, simple, UMD, cross-browser way to use console.log during development & testing.

To support this project, you can at the support page by supporting the developer.

Getting Started

NPM (What is NPM? What is Grunt?)

npm install qulog --save-dev

Bower (What is Bower?)

bower install qulog --save-dev

Download directly (Do not link this directly on your site, the file is sent with a plain/text header and can cause loading problems)

API & Usage

Aiming the convenience and favours of developers, turning on and off the logging made possible with toggle-pairs. The toggle-pairs allow to set on/off logging by the properties and functions below using boolean (true/false) values.

PropertyFunctionalityExample
.onturns on or off output to console (true/false)qulog.on = true OR qulog.on = false
.offturns off or on output to console (true/false)qulog.off = true OR qulog.off = false
.debugsame as .onqulog.debug = true OR qulog.debug = false
.productionsame as .offqulog.production = true OR qulog.production = false
FunctionFunctionalityExample
.setOn(true/false)turns on or off output to console (true/false)qulog.setOn(true) OR qulog.setOn(false)
.setOff(true/false)turns off or on output to console (true/false)qulog.setOff(true) OR qulog.setOff(false)
.setDebug(true/false)same as .setOn()qulog.setDebug(true) OR qulog.setDebug(false)
.setProduction(true/false)same as .setOff()qulog.setProduction(true) OR qulog.setProduction(false)

By default, qulog is turned on. (qulog.on === true)

In Node.js

    var qulog = require("./node_modules/qulog");

In Browser (NPM)

    <script src="node_modules/qulog/qulog.js"></script>

In Browser (Bower)

    <script src="bower_components/qulog/qulog.js"></script>

In Browser (Require.js)

    <script>
        require(["scripts/qulog"], function(qulog) {
                /* qulog is accessible from now on */
        });
    </script>

In Browser (Directly downloaded source)

    <script src="scripts/qulog.js"></script>

In the code:

During development & testing:

    /* after assigned qulog to a variable called "log" */
    function testFunctionality() {
        /* This below should appear in console */
        log("-> testFunctionality was called");
        /* Do logic afterwards */
    };

Turn off output to console:

    /* after assigned qulog to variable called "log" */
    log.on = false; 

    function testFunctionality() {
        /* This below SHOULD NOT appear in console */
        log("-> testFunctionality was called");
        /* Do logic afterwards */
    };

Using other functions for achieving the same functionality (toggle-pairs)

    /* after assigned qulog to variable called "log" */

    /* These will turn off output to console
       and they are functionally equivalent, toggle-pairs */
    log.on = false; /* or */ log.debug = false;
    /* or */
    log.off = true; /* or */ log.production = true;
    
    function testFunctionality() {
        /* This below SHOULD NOT appear in console */
        log("-> testFunctionality was called");
        /* Do logic afterwards */
    };
    
    /* To turn on output to console again */
    log.on = true; /* or */ log.debug = true;
    /* or */
    log.off = false; /* or */ log.production = false;

    function testFunctionality() {
        /* This below should appear in console */
        log("-> testFunctionality was called");
        /* Do logic afterwards */
    };

In Internet Explorer 8 and Below:

    /* after assigned qulog to variable called "log" */
    
    /* Properties (.on/.off/.debug/.production)
       are not available in IE8 and lower
       Use instead the appropriate functions */
    log.setOn(false); /* or */ log.setDebug(false);
    /* or */
    log.setOff(true); /* or */ log.setProduction(true);

    function testFunctionality() {
        /* This below SHOULD NOT appear in console */
        log("-> testFunctionality was called");
        /* Do logic afterwards */
    };

Internet Explorer 8 and Below

As this tool is intended to use with and tested too with IE9+ and with modern browsers, although works well with IE8, it is not recommended to use with IE8 or lower.

  • use setOn/setOff and setDebug/setProduction instead of .on/.off/.debug/.production properties (IE8 properties issue)
  • jasmine tests in IE8 or lower will fail

Suggestions, Ideas & Requests

Post any occurring suggestions, useful ideas and requests to the project's issue page under the suggestion/idea/request label by clicking here.

  • Constructive criticism is encouraged and welcomed by contacting the developer or using GitHub.

Issues/Bugs

In case of any occurring issues and/or bugs, post on the project's issues page with appropriate label(s).

Support

If you find this tool useful, you can support this project by supporting the developer here.

Contribution & A Note

In the spirit of open source software development, this project is always open to and encourages community code contribution. To get started, just run through the source file, check the comments and general coding style and start to contribute.

  • In case you find this tool useful, support it by supporting the developer, follow the developer on social platforms or send an email to the developer.

License

Copyright (c) 2014 "Richard KnG" Richárd Szakács. Licensed under the MIT license.

The license mentioned above applies to all parts of this software except as documented below

All files located in the node_modules and external directories are externally maintained libraries used by this software which have their own licenses. We recommend you read them, as their terms may differ from the terms above.