Giter Site home page Giter Site logo

garysweaver / autolog.js Goto Github PK

View Code? Open in Web Editor NEW
8.0 1.0 2.0 124 KB

JavaScript call trace to console.log library with some formatting config. Logs Function.prototype.call executions to console.log, with caller stack line or full caller stack, with optionally elipsized function bodies.

License: MIT License

JavaScript 100.00%

autolog.js's Introduction

Autolog.js

Note: prototype hacking doesn't work well with libraries like AngularJS. If you are interested in a more compatible automatic console logging solution, take a look at noisify.

Logs Function.prototype.call executions to console.log, with caller stack line or full caller stack, with optionally elipsized function bodies.

This allows you see what is going on to a limited extent as Javascript is executed, similar to a trace log to console.

Example output in Chrome's JavaScript Console:

[object NamedNodeMap].toString ()  source: at isArrayLike (http://example.org/assets/angular.js?body=1:39:83) 
undefined.anonymous ((object)[object Attr], (number)0)  source: at forEach (http://example.org/assets/angular.js?body=1:55:20)
undefined.anonymous ((object)$compile,$parse,function ($compile, $parse) {...}, (string)"select")  source: at forEach (http://example.org/assets/angular.js?body=1:59:22)

Original direction came from this answer from HBP on StackOverflow.

Submit a pull request if you'd like to clean it up, extend it, fix it, make it available to npm/node, bower, etc.

*** Under Development ***

Note: please submit any issues you have, hopefully with a corresponding PR. This library is still under development and may not work properly.

Usage

To turn on:

Autolog.on();

To turn off:

Autolog.off();

Configuration

Autolog.includeCallerLocation(true);
Autolog.includeCallStack(false);
Autolog.includeFunctionBodies(false);

Contributors

License

Copyright (c) 2013 Gary S. Weaver, released under the MIT license.

autolog.js's People

Contributors

garysweaver avatar jonathan-beckwith avatar

Stargazers

 avatar Michael Jett avatar Pantelis Koukousoulas avatar nlac avatar Itay Weinberger avatar  avatar Scott Elcomb avatar  avatar

Watchers

 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.