Package Exports
- elm-debug-transformer
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (elm-debug-transformer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
The standard Elm Debug.log
console output:
and the same output with this package
The main module exposes register()
function that replaces your console.log()
and try to parse each incoming message with Elm parser. If it fails, it would pass the original message.
Installation
Just install this module with:
yarn add -D elm-debug-transformer
Usage
Register the console debugger in your main JS file before you initialize Elm application:
import * as ElmDebugger from 'elm-debug-transformer';
ElmDebugger.register();
// rest of application
Enable custom formatters in Chrome dev tools
Available in Chrome 47 and higher.
The output object is kind of chatty right now (it carries information about parsed type etc. - less verbose version is worked on right now).
If your browser have Chrome dev toools, you can enable custom formatters so you get less noice and nice output.
- Open DevTools
- Go to Settings ("three dots" icon in the upper right corner of DevTools > Menu > Settings F1 > Preferences > Console)
- Check-in "Enable custom formatters"
- Close DevTools
- Open DevTools
Note: You might need to refresh the page first time you open Console panel with existing logs - custom formatters are applied only to newly printed console messages.
Simple object output
import * as ElmDebugger from 'elm-debug-transformer';
ElmDebugger.register({simple_mode: true});
If you are not a fan of Chromium based browser you can pass option to the register
function.
register({simple_mode: true});
That way the Debug.log
would output simpler JS object without type
information. Tuple
, Set
, Array
and List
would become arrays and Dict
would become JS object with keys and values.
Credits
This would probably not see the light of the day without Matt Zeunert and his blogpost about writing custom formatters. Thank you!