Console log to document

Provides the output of `console` methods into the document.


Project maintained by ismael-miguel Hosted on GitHub Pages — Theme by mattgraham

Console log to document

Provides the output of console methods into the document.

How to use

This is actually really easy to use!

1- Get either the minified/packed version or the plain version to study and change code,

2- Include the files in your HTML pages or copy-paste the code directly into your browser's console,

3- Add console._RELAY_TO_DOC = true; to your Javascript.

4- Use the console.log() on the way you intended!

5- You have finished all the steps to use the code!
No more opening the console! (but the output is still redirected there)

Advanced usage

There are a few settings that you can use to change the functionality of your code.

Remember, if you enable console._USE_JSON = true;, all the other options won't take effect. Except the 1st, obviously.
All the changes made will only be reflected on the next time you run console.log().

Methods

2 Useful methods are added to the console:

Writting to the console

It is really easy to write into the console:
Simply call console.log() and you are set!

It has nearly-identical to the native console output.
Also, this supports formatted strings (in a very basic form):

Using console.clear() will delete the messages that were added to the element/document.
This is enabled by default.

Implemented console methods:

All the following methods work as expected.
Also, they display an icon to identify the message type.

This also catches uncaught errors and exceptions.
All credits due to the user @canon on http://meta.stackexchange.com/ for this functionality, on his awesome implementation
He was kind enough to let me use his code!

If you want, you can link directly to one of the following:

For that, just include the following code on your <head>

<script src="http://ismael-miguel.github.io/console-log-to-document/files/console.log.min.js"></script>