Skip to content

Feature Request: Auto-attach without clobbering iex prompt in dev env #73

@axelson

Description

@axelson

Note: I'm extracting this from a conversation with Frank on Slack so that we don't lose the conversation history.

I would like a feature that would allow ring_logger to automatically attach to an IEx prompt without clobbering the iex prompt. I have a proof-of-concept here (note that it uses OTP internals... as does Elixir):
axelson@85e22f3

The reason I want this is because when working on Elixir applications (such as a phoenix app) I almost always use iex -S mix phx.server and any logger output from the application will overwrite my IEx prompt and I cannot see what I am typing.

I was thinking of submitting this as a PR to ring_logger but it might be out of scope. So maybe it would make more sense to fork ring_logger instead (the new name might be something like dev_logger).

I have a couple other features in mind for dev_logger, like an optional Phoenix integration that would allow you to see and search your logs in the browser (this could be done as a Phoenix LiveDashboard integration (which Frank suggested)).

We also discussed integrating via .iex.exs but philosophically I’d personally prefer to avoid that. Partially because some projects may gitignore the .iex.exs and I just feel that the contents in there should be very specific to the project rather than “configuring” libraries. And if not written carefully it will cause a iex (instead of iex -S mix) in that directory to fail.

From Frank:

RingLogger is showing its age, and my original thought was to rewrite it to use Erlang’s logger. I did that, but it has usability issues that need to be addressed.
Having said that, I removed the “attach” functionality from the Erlang version. The reason was that I was able to do it more simply in Toolshed. See log_attach and log_detach.

So I'm not sure exactly where we stand at this point. I guess my question is still: Does it make sense to integrate an auto-attach to IEx in development within RingLogger? Or should I create a new library instead?

Although in either case I'd like to add an optional Phoenix LiveDashboard integration for RingLogger (and DevLogger if it exists) that would show and allow searching of the logs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions