Deppie v1.0.0 Deppie

Deppie is a very small library to make logging deprecation warnings easy.

Typically you want to notify the user on first use of a deprecated function, rather than every time they use the function. Deppie makes this easy in an efficient and convenient way - the typical overhead of a Deppie.once/1 call is under a single microsecond.

Summary

Functions

Emits a deprecation message the first time this function is called

Resets Deppie to the initial state

Emits a deprecation message every time this function is called

Functions

once(msg)

Specs

once(msg :: bitstring) :: :ok

Emits a deprecation message the first time this function is called.

This makes it easy to log deprecation on first usage, rather than having to check manually.

Examples

iex> Deppie.once("MyModule.my_function/1 is deprecated!")
:ok
reset()

Specs

reset :: :ok

Resets Deppie to the initial state.

This is typically of no use to anybody outside this library.

Examples

iex> Deppie.reset()
:ok
warn(msg)

Specs

warn(msg :: bitstring) :: :ok

Emits a deprecation message every time this function is called.

This is a less frequent use case, but it’s used internally by Deppie.once/1 to avoid duplication of any log formatting.

Examples

iex> Deppie.warn("MyModule.my_function/1 is deprecated!")
:ok