this repo has no description
2
fork

Configure Feed

Select the types of activity you want to include in your feed.

Extract inspect arguments for hashing in SimLogger

garrison 10561494 52391a64

+9 -2
+7 -1
lib/trinity/sim_logger.ex
··· 60 60 {:<<>>, _, elements} -> 61 61 # Extract interpolated variables 62 62 Enum.reduce(elements, [], fn 63 - {:"::", _, [{{:., _, [Kernel, :to_string]}, _, [value]}, {:binary, _, _}]}, acc -> [value | acc] 63 + {:"::", _, [{{:., _, [Kernel, :to_string]}, _, [value]}, {:binary, _, _}]}, acc -> 64 + case value do 65 + # Extract value from `inspect(value)` because the string representation may not be deterministic 66 + # (e.g. for maps) 67 + {:inspect, _, inspect_value} -> [inspect_value | acc] 68 + value -> [value | acc] 69 + end 64 70 _, acc -> acc 65 71 end) 66 72 |> Enum.reverse()
+2 -1
test/trinity_test.exs
··· 26 26 {:ok, fd} = SimFile.open("/counters/#{id}/#{id}.count", [:read, :write]) 27 27 assert SimFile.ls("/counters/#{id}/") == {:ok, ["#{id}.count"]} 28 28 29 - SimLogger.debug "Init (id=#{fd}, fd=#{fd}, initial_count=#{initial_count})" 29 + SimLogger.debug "Init (id=#{id}, fd=#{fd}, initial_count=#{initial_count})" 30 30 31 31 state = %{ 32 32 fd: fd, 33 33 size: nil, 34 34 } 35 35 state = write_value(state, initial_count) 36 + SimLogger.debug "Initial state (id=#{id}): #{inspect(state)}" 36 37 37 38 # Note: this intentionally tests a log message with no variables 38 39 SimLogger.debug "Init complete"