Skip to content

Commit

Permalink
Do preserve the legacy API, but log a warning
Browse files Browse the repository at this point in the history
  • Loading branch information
tompave committed Dec 14, 2023
1 parent f9036f7 commit 5127828
Showing 1 changed file with 50 additions and 4 deletions.
54 changes: 50 additions & 4 deletions lib/fun_with_flags.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,56 @@ defmodule FunWithFlags do
See the [Usage](/fun_with_flags/readme.html#usage).
"""

use FunWithFlags.EntryPoint
defmodule PrivateEntryPoint do
@moduledoc false
use FunWithFlags.EntryPoint

@impl true
def config do
{:ok, []}
@impl true
def config do
{:ok, []}
end
end

require Logger
@deprecation_msg "Using the FunWithFlags module directly is deprecated. (TODO link to docs)"

def enabled?(flag_name, options \\ []) do
Logger.warning(@deprecation_msg)
PrivateEntryPoint.enabled?(flag_name, options)
end

def enable(flag_name, options \\ []) do
Logger.warning(@deprecation_msg)
PrivateEntryPoint.enable(flag_name, options)
end

def disable(flag_name, options \\ []) do
Logger.warning(@deprecation_msg)
PrivateEntryPoint.disable(flag_name, options)
end

def clear(flag_name, options \\ []) do
Logger.warning(@deprecation_msg)
PrivateEntryPoint.clear(flag_name, options)
end

def all_flag_names() do
Logger.warning(@deprecation_msg)
PrivateEntryPoint.all_flag_names()
end

def all_flags() do
Logger.warning(@deprecation_msg)
PrivateEntryPoint.all_flags()
end

def get_flag(flag_name) do
Logger.warning(@deprecation_msg)
PrivateEntryPoint.get_flag(flag_name)
end

def compiled_store() do
Logger.warning(@deprecation_msg)
PrivateEntryPoint.compiled_store()
end
end

0 comments on commit 5127828

Please sign in to comment.