Slog v0.1.1 Slog View Source

Documentation for Slog.

Print multiple values as string (except functions and binaries) for debugging. Slog takes a list of values or a single value that is printed as string for debugging. Any value (string, atom, map, list, struct, keyword list …) except functions can be printed as string with slog.

Link to this section Summary

Functions

logs given list of data, takes optional keyword list

Link to this section Functions

logs given list of data, takes optional keyword list

Examples

# define user struct 
defmodule User do
  defstruct name: "Arun", age: 29
end

# iex> import User
# User

iex> Slog.log ["value is ", {:x, :x, :x}, [key: "value"], {:ok, "Hello Universe!"}]
"value is  {:x, :x, :x} [{:key, value}] {:ok, Hello Universe!}"

iex> Slog.log ["hello", "universe"], stdout: true, delimiter: "---"
"hello---universe"

iex> Slog.log ["value is ", {:x, :x, :x}, [key: "value"], {:ok, "Hello Universe!"}, %User{age: 29, name: "Arun"}]
"value is  {:x, :x, :x} [{:key, value}] {:ok, Hello Universe!} %User{age: 29, name: Arun}"

iex> Slog.log ["value is ", {:x, :x, :x}, [key: "value"], {:ok, "Hello Universe!"}], delimiter: " --> "
"value is  --> {:x, :x, :x} --> [{:key, value}] --> {:ok, Hello Universe!}"

iex> Slog.log {:hello, "Universe!"}
"{:hello, Universe!}"

iex> Slog.log %{name: "Arun", age: 29}
"%{age: 29, name: Arun}"

iex> Slog.log %{manager: %User{name: "Leonardo", age: 69}}
"%{manager: %User{age: 69, name: Leonardo}}"