View Source NLdoc.Test.Logs (NLdoc.Test v2.1.0)

This module helps with capturing log output in tests.

Summary

Functions

Decodes each line in the given log string with Jason.decode/1.

Functions

decode_json(logs)

@spec decode_json(String.t()) :: [map()]

Decodes each line in the given log string with Jason.decode/1.

Examples

iex> logs = "{\"message\": \"test\"}\n{\"message\": \"another test\"}\n\n"
iex> logs |> NLdoc.Test.Logs.decode_json()
[%{"message" => "test"}, %{"message" => "another test"}]
iex> [%{"message" => "test"}] |> match?(logs |> NLdoc.Test.Logs.decode_json())