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 · 4 comments

Comments

Projects
None yet
3 participants
@Fresheyeball

Fresheyeball commented May 30, 2016

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

This comment has been minimized.

Show comment
Hide comment
@noahzgordon

noahzgordon Jun 6, 2016

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);
Contributor

noahzgordon commented Jun 6, 2016

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

This comment has been minimized.

Show comment
Hide comment
@Fresheyeball

Fresheyeball 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.

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

This comment has been minimized.

Show comment
Hide comment
@noahzgordon

noahzgordon Jun 6, 2016

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?

Contributor

noahzgordon commented Jun 6, 2016

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

This comment has been minimized.

Show comment
Hide comment
@Fresheyeball

Fresheyeball Jun 6, 2016

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 notifications@github.com
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_
.

Fresheyeball commented Jun 6, 2016

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 notifications@github.com
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 from Feature Request: Better Debugging to expose more debugging features, like console.group Sep 23, 2016

@evancz evancz added the request label Sep 23, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment