PhoenixKit.API.LogSafe (phoenix_kit v2.63.0)

Copy Markdown View Source

What the API may write to the server log about a term that came from a request or from code that handled one.

The log learns the kind and the size of a term, never its values: they may hold bearer tokens, cart tokens or personal data. The exception message is kept only for the exceptions in @fixed_message_exceptions, and then as the text of the exception class, never the text the instance carries.

Summary

Functions

An exception as the log may see it: ** (Module), followed by its message (cut at 500 code points) only for the exceptions with a fixed message.

The shape of a term, without its values: "a map", "a binary of 12 bytes", "a tuple of size 2 tagged :ok", "a Plug.Conn struct".

The first limit code points of string (not graphemes: a single grapheme can be arbitrarily long).

Functions

exception_label(error)

@spec exception_label(Exception.t()) :: String.t()

An exception as the log may see it: ** (Module), followed by its message (cut at 500 code points) only for the exceptions with a fixed message.

shape(value)

@spec shape(term()) :: String.t()

The shape of a term, without its values: "a map", "a binary of 12 bytes", "a tuple of size 2 tagged :ok", "a Plug.Conn struct".

take_codepoints(string, limit)

@spec take_codepoints(String.t(), non_neg_integer()) :: String.t()

The first limit code points of string (not graphemes: a single grapheme can be arbitrarily long).