Skip to content

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

Notifications You must be signed in to change notification settings

garysweaver/autolog.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

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.

About

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.

Resources

License

Stars

Watchers

Forks

Packages

No packages published