secure_log_formatter v1.1.0 SecureLogFormatter

Documentation for SecureLogFormatter.

Summary

Functions

Secure formatting for Elixir Logger

Securely inspect a value

Sanitize the input value

Functions

default_fields()
format(level, msg, ts, md)

Secure formatting for Elixir Logger

Examples

iex> SecureLogFormatter.format(:info, "CC 4111111111111111", nil, [])
["\n", :time, " ", "", "[", "info", "] ", " ", "CC [REDACTED]", "\n"]
inspect(message)

Securely inspect a value.

Examples

iex> SecureLogFormatter.inspect(%{user: "username", password: "abc123"})
~s(%{password: "[REDACTED]", user: "username"})

iex> SecureLogFormatter.inspect([access_token: "secret"])
~s([access_token: "[REDACTED]"])

iex> SecureLogFormatter.inspect("Customer CC 4111111111111111")
~s("Customer CC [REDACTED]")
sanitize(data)

Sanitize the input value.

Examples

iex> SecureLogFormatter.sanitize(%{user: "username", password: "abc123"})
%{password: "[REDACTED]", user: "username"}

iex> SecureLogFormatter.sanitize([access_token: "secret"])
[access_token: "[REDACTED]"]

iex> SecureLogFormatter.sanitize("Customer CC 4111111111111111")
"Customer CC [REDACTED]"