Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions lib/rexbug/printing.ex
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,13 @@ defmodule Rexbug.Printing do
end
end

defmodule Meta do
@type t :: %__MODULE__{}
defstruct ~w(msg time)a

def represent(_struct, _opts), do: nil
end

# ===========================================================================
# Public Functions
# ===========================================================================
Expand All @@ -174,7 +181,13 @@ defmodule Rexbug.Printing do
@doc false
@spec print_with_opts(tuple(), Keyword.t()) :: :ok
def print_with_opts(message, opts) do
IO.puts("\n" <> format(message, opts))
case format(message, opts) do
nil ->
:ok

formatted ->
IO.puts("\n" <> formatted)
end
end

@doc false
Expand Down Expand Up @@ -245,6 +258,13 @@ defmodule Rexbug.Printing do
}
end

def from_erl({:meta, msg, _pi, time}) do
%Meta{
msg: msg,
time: Timestamp.from_erl(time)
}
end

# fallthrough so that you can use it indiscriminately
def from_erl(message) do
message
Expand All @@ -259,7 +279,7 @@ defmodule Rexbug.Printing do
end

@doc false
def represent(%mod{} = struct, opts) when mod in [Call, Return, Send, Receive] do
def represent(%mod{} = struct, opts) when mod in [Call, Return, Send, Receive, Meta] do
mod.represent(struct, opts)
end

Expand Down
2 changes: 1 addition & 1 deletion mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ defmodule Rexbug.Mixfile do
# Type "mix help deps" for more examples and options
defp deps do
[
{:redbug, "~> 1.2"},
{:redbug, "~> 2.0"},

# test/housekeeping stuff
{:excoveralls, ">= 0.4.0", optional: true, only: :test},
Expand Down
2 changes: 1 addition & 1 deletion mix.lock
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"mix_test_watch": {:hex, :mix_test_watch, "1.0.2", "34900184cbbbc6b6ed616ed3a8ea9b791f9fd2088419352a6d3200525637f785", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}], "hexpm", "47ac558d8b06f684773972c6d04fcc15590abdb97aeb7666da19fcbfdc441a07"},
"nimble_parsec": {:hex, :nimble_parsec, "0.5.3", "def21c10a9ed70ce22754fdeea0810dafd53c2db3219a0cd54cf5526377af1c6", [:mix], [], "hexpm", "589b5af56f4afca65217a1f3eb3fee7e79b09c40c742fddc1c312b3ac0b3399f"},
"parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm", "17ef63abde837ad30680ea7f857dd9e7ced9476cdd7b0394432af4bfc241b960"},
"redbug": {:hex, :redbug, "1.2.1", "9153ee50e42c39ce3f6efa65ee746f4a52896da66862cfb59e7c0f838b7b8414", [:rebar3], [], "hexpm", "bfc7bcb8743c55dbe0134dbcb89dd6a57606288cc4e2570eccd701061fbcbd93"},
"redbug": {:hex, :redbug, "2.0.8", "b25f8534d751cec40ba3699986dcdb5953ab580bb5cad8b152bda905239da406", [:rebar3], [], "hexpm", "8c8176473ce9c8609dee085639ab9a657e4a663ebbb84ddd09f71454464d2957"},
"ssl_verify_fun": {:hex, :ssl_verify_fun, "1.1.5", "6eaf7ad16cb568bb01753dbbd7a95ff8b91c7979482b95f38443fe2c8852a79b", [:make, :mix, :rebar3], [], "hexpm", "13104d7897e38ed7f044c4de953a6c28597d1c952075eb2e328bc6d6f2bfc496"},
"unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm", "1d1848c40487cdb0b30e8ed975e34e025860c02e419cb615d255849f3427439d"},
}