diff --git a/lib/csys/csys.ex b/lib/csys/csys.ex index 13c1398..f52e254 100644 --- a/lib/csys/csys.ex +++ b/lib/csys/csys.ex @@ -58,7 +58,7 @@ defmodule Scopes.CSys do # send shortcuts def send_message(rcvr, head, data \\ %{}) do - Logger.info rcvr: inspect(rcvr), head: inspect(head), data: inspect(data) + Logger.debug rcvr: inspect(rcvr), head: inspect(head), data: inspect(data) Actor.send(rcvr, Shape.create(head, data: data)) end diff --git a/lib/csys/program.ex b/lib/csys/program.ex index c9b48ad..f589298 100644 --- a/lib/csys/program.ex +++ b/lib/csys/program.ex @@ -74,7 +74,7 @@ defmodule Scopes.CSys.Program do limit = args[:limit] data = Shape.data(msg) state = CSys.state(scope) - Logger.info data: data, state_value: state.value, threshold: threshold, self: self() + Logger.debug data: data, state_value: state.value, threshold: threshold, self: self() value_n = state.value + data.value if value_n >= threshold do value_out = limit && rem(value_n - 1, limit) + limit || value_n diff --git a/lib/util.ex b/lib/util.ex index 35849d0..a103e62 100644 --- a/lib/util.ex +++ b/lib/util.ex @@ -6,4 +6,12 @@ defmodule Scopes.Util do Enum.zip(names, fields) |> Map.new end end + + defmacro lgi(fields) do + #IO.inspect(fields) + quote do + require Logger + Logger.info(Scopes.Util.fields_info(unquote(fields))) + end + end end diff --git a/test/util_test.exs b/test/util_test.exs index 803b478..5a1c5d4 100644 --- a/test/util_test.exs +++ b/test/util_test.exs @@ -8,6 +8,7 @@ defmodule Scopes.UtilTest do test "fields" do {a, b, c} = {17, 22, 42} assert %{"a" => 17, "b" => 22, "c" => 42} = Util.fields_info([a, b, c]) + Util.lgi([a, b, c]) end end end