Skip to content

romul/dbg_inspect

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DbgInspect

dbg_inspect provides Dbg.inspect/2 macro, which is an extended version of IO.inspect/1 function for the debug purposes.

Additional Features

  • Prints representation of expression passed as the first argument
  • Prints file name and line number where Dbg.inspect/2 was called
  • Ability to print values of all variables used in the expression passed as the first argument
  • Colored output
  • Output to :stderr stream
  • No affects prod environment

Example

  list = [1, 2, 3]
  zero = 0

  list
  |> Enum.map(&{&1, to_string(&1 * &1)})
  |> Enum.into(%{})
  |> Map.put(zero, to_string(zero))
  |> Dbg.inspect(show_vars: true)

output

Installation

The package can be installed by adding dbg to your list of dependencies in mix.exs:

def deps do
  [
    {:dbg_inspect, "~> 0.1.0"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/dbg.

About

Implementation of dbg! Rust-macro for Elixir

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages