Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

expose more debugging features, like console.group #633

Open
Fresheyeball opened this issue May 30, 2016 · 5 comments
Open

expose more debugging features, like console.group #633

Fresheyeball opened this issue May 30, 2016 · 5 comments
Labels

Comments

@Fresheyeball
Copy link

As it stands Debug.log is the only thing provided for instrumenting and debugging code in Elm, and it's not usable for all cases.

For example, there might be a deeply nested structure represented by the top level Model of the application. With Debug.log we are given an un-usable display of this complex structure as a single string without even basic indentation.

Instead lets make this kick ass. With something much more similar to the experience of logging a native javascript object to the console; where nested structures can be collapsed or expanded.

I believe this can be accomplished using console.group, or some similar technique.

@noahzgordon
Copy link
Contributor

Right now it looks like the Debug.log function simply calls toString on the second argument (the value being logged) and appends it to the first argument. Would it be reasonable to log the value directly instead?

    var msg = tag + ': ' + _elm_lang$core$Native_Utils.toString(value);
        ...
    console.log(msg);

becomes...

console.log(tag, value);

@Fresheyeball
Copy link
Author

Fresheyeball commented Jun 6, 2016

There is kind of a lot that could be done here. I ended having to write this as a band-aid. https://gist.github.com/Fresheyeball/94e25fcefc517a74382e55283eec9093

But I wouldn't consider it a solution. I'm starting to think Elm should just expose (almost) the entirety of this: https://developer.chrome.com/devtools/docs/console-api .

And in two styles (we might want logging for things other than debugging).

Console.log : String -> Task Never ()

and for debugging in a raw way

Debug.log : String -> a -> a

This way it would be possible for Elm library authors to put together their own debugging packages.

@noahzgordon
Copy link
Contributor

Sounds like a cool idea! Perhaps we could start working on an elm-debug-extra or elm-developer-console library in order to expose more of the Console API?

@Fresheyeball
Copy link
Author

No go. Elm rejects anything native. It needs to be owned by elm-lang.

I'd be happy to take this on, but @evancz would need to bless me for the
task.
On Mon, Jun 6, 2016 at 9:15 AM Noah Zachary Gordon [email protected]
wrote:

Sounds like a cool idea! Perhaps we could start working on an
elm-debug-extra or elm-developer-console library in order to expose more
of the Console API?


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/elm-lang/core/issues/633#issuecomment-223990254, or mute
the thread
https://github.com/notifications/unsubscribe/AAlL_ws6r-u2VcuQY70QX4BX75TNsim7ks5qJDmugaJpZM4IqDN_
.

@evancz evancz changed the title Feature Request: Better Debugging expose more debugging features, like console.group Sep 23, 2016
@evancz evancz added the request label Sep 23, 2016
@dullbananas
Copy link

good idea

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants