From f87bd3ee363094e8d3716fb9f4415d9b71a931f6 Mon Sep 17 00:00:00 2001 From: sloane <1699281+sloanelybutsurely@users.noreply.github.com> Date: Sat, 17 Feb 2024 08:47:19 -0500 Subject: [PATCH] configure logger --- config/config.exs | 4 ++++ lib/mix/tasks/site.build.ex | 1 + lib/mix/tasks/site.dev.ex | 1 + lib/mix/tasks/site.serve.ex | 9 +-------- lib/mix/tasks/site.watch.ex | 1 + 5 files changed, 8 insertions(+), 8 deletions(-) create mode 100644 config/config.exs diff --git a/config/config.exs b/config/config.exs new file mode 100644 index 0000000..2b5efec --- /dev/null +++ b/config/config.exs @@ -0,0 +1,4 @@ +import Config + +config :logger, :default_formatter, + format: "$time $metadata[$level] $message\n" diff --git a/lib/mix/tasks/site.build.ex b/lib/mix/tasks/site.build.ex index f654a76..f93caf2 100644 --- a/lib/mix/tasks/site.build.ex +++ b/lib/mix/tasks/site.build.ex @@ -8,6 +8,7 @@ defmodule Mix.Tasks.Site.Build do @impl Mix.Task def run(_args) do + Mix.Task.run("app.start") {micro, :ok} = :timer.tc(&SloaneSH.build/0) Logger.info("Built site in #{Format.time(micro)}") end diff --git a/lib/mix/tasks/site.dev.ex b/lib/mix/tasks/site.dev.ex index 47f4c14..ff90ddc 100644 --- a/lib/mix/tasks/site.dev.ex +++ b/lib/mix/tasks/site.dev.ex @@ -5,6 +5,7 @@ defmodule Mix.Tasks.Site.Dev do @impl Mix.Task def run(_args) do + Mix.Task.run("app.start") {:ok, watch_pid} = Task.start_link(fn -> Mix.Task.run("site.watch") diff --git a/lib/mix/tasks/site.serve.ex b/lib/mix/tasks/site.serve.ex index cbebd5b..34a9d12 100644 --- a/lib/mix/tasks/site.serve.ex +++ b/lib/mix/tasks/site.serve.ex @@ -6,16 +6,9 @@ defmodule Mix.Tasks.Site.Serve do @impl Mix.Task def run(_args) do + Mix.Task.run("app.start") Logger.info("Starting development server...") - {:ok, _} = - Application.ensure_all_started([ - :telemetry, - :plug, - :thousand_island, - :bandit - ]) - {:ok, pid} = SloaneSH.serve() unless iex_running?() do diff --git a/lib/mix/tasks/site.watch.ex b/lib/mix/tasks/site.watch.ex index d1d6dcf..02c71fe 100644 --- a/lib/mix/tasks/site.watch.ex +++ b/lib/mix/tasks/site.watch.ex @@ -6,6 +6,7 @@ defmodule Mix.Tasks.Site.Watch do @impl Mix.Task def run(_args) do + Mix.Task.run("app.start") Logger.info("Starting site.watch...") {:ok, pid} = SloaneSH.watch()