Added log level to runtime config (#55)
This commit is contained in:
parent
d0f55cd463
commit
6e195f6a6f
1 changed files with 11 additions and 0 deletions
|
|
@ -37,6 +37,17 @@ if config_env() == :prod do
|
||||||
log_path = System.get_env("LOG_PATH", Path.join([config_path, "logs", "pinchflat.log"]))
|
log_path = System.get_env("LOG_PATH", Path.join([config_path, "logs", "pinchflat.log"]))
|
||||||
metadata_path = System.get_env("METADATA_PATH", Path.join([config_path, "metadata"]))
|
metadata_path = System.get_env("METADATA_PATH", Path.join([config_path, "metadata"]))
|
||||||
|
|
||||||
|
# We want to force _some_ level of useful logging in production
|
||||||
|
acceptable_log_levels = ~w(debug info)
|
||||||
|
log_level = String.to_existing_atom(System.get_env("LOG_LEVEL", "info"))
|
||||||
|
|
||||||
|
if log_level in acceptable_log_levels do
|
||||||
|
config :logger, level: log_level
|
||||||
|
else
|
||||||
|
Logger.error("Invalid log level: #{log_level}. Defaulting to info.")
|
||||||
|
config :logger, level: :info
|
||||||
|
end
|
||||||
|
|
||||||
config :pinchflat,
|
config :pinchflat,
|
||||||
yt_dlp_executable: System.find_executable("yt-dlp"),
|
yt_dlp_executable: System.find_executable("yt-dlp"),
|
||||||
metadata_directory: metadata_path,
|
metadata_directory: metadata_path,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue