Skip to content

A log behavior for polymer elements, based on visionmedia-debug

License

Notifications You must be signed in to change notification settings

pwasem/log-behavior

Repository files navigation

PolymerElements.LogBehavior

PolymerElements.LogBehavior wraps the visionmedia/debug library to enable filterable logging per element and level.

To enable logs visionmedia/debug requires localeStorage.debug to be set to your desired scope, e.g. my-element:error. For your convenience this can be done using an instance of the bundled <locale-storage> element, instead of setting the scope directly via your browser console.

It is meant to be used in development as well as in production.

See the component-page for full documentation.

Example usage:

    <dom-module id="my-element">
       <template>
         <locale-storage debug="my-element:*"></locale-storage>
       </template>
       <script type="text/javascript">
          Polymer({

            is: 'my-element',

            behaviors: [
              PolymerElements.LogBehavior
            ],

            ready: function() {
              this._log.info('this is an info message');
              this._log.debug('this is a debug message');
              this._log.trace('this is a trace message');
              this._log.warn('this is a warn message');
              this._log.error('this is a error message');
            },
          });
       </script>
    </dom-module>

About

A log behavior for polymer elements, based on visionmedia-debug

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages