Download Github

Demo of console-log

<console-log> is a simple web-component which provides access to the browser console for logging purposes. It supports both simple strings and complex JavaScript objects, which can be expanded in the console window.

Simple

After including the typical boilerplate code for polymer, logging a message to the console is as simple as:


<script src="../webcomponentsjs/webcomponents-lite.min.js"></script>
<link rel="import" href="console-log.html">

<console-log log="Hello world"> </console-log>

Debugging data bindings

<console-log> is useful to debug data bindings.


<template is="dom-repeat" items='["Bob", "Sally"]'>
   <console-log log="{{item}}"> </console-log>
</template>

Log levels

After including the typical boilerplate code for polymer, logging a message to the console is as simple as:


<console-log log="log message"> </console-log>
<console-log info="info message"> </console-log>
<console-log warn="warn message"> </console-log>
<console-log error="error message"> </console-log>