configure logger

This commit is contained in:
sloane 2024-02-17 08:47:19 -05:00
parent 5166c17450
commit f87bd3ee36
5 changed files with 8 additions and 8 deletions

4
config/config.exs Normal file
View file

@ -0,0 +1,4 @@
import Config
config :logger, :default_formatter,
format: "$time $metadata[$level] $message\n"

View file

@ -8,6 +8,7 @@ defmodule Mix.Tasks.Site.Build do
@impl Mix.Task @impl Mix.Task
def run(_args) do def run(_args) do
Mix.Task.run("app.start")
{micro, :ok} = :timer.tc(&SloaneSH.build/0) {micro, :ok} = :timer.tc(&SloaneSH.build/0)
Logger.info("Built site in #{Format.time(micro)}") Logger.info("Built site in #{Format.time(micro)}")
end end

View file

@ -5,6 +5,7 @@ defmodule Mix.Tasks.Site.Dev do
@impl Mix.Task @impl Mix.Task
def run(_args) do def run(_args) do
Mix.Task.run("app.start")
{:ok, watch_pid} = {:ok, watch_pid} =
Task.start_link(fn -> Task.start_link(fn ->
Mix.Task.run("site.watch") Mix.Task.run("site.watch")

View file

@ -6,16 +6,9 @@ defmodule Mix.Tasks.Site.Serve do
@impl Mix.Task @impl Mix.Task
def run(_args) do def run(_args) do
Mix.Task.run("app.start")
Logger.info("Starting development server...") Logger.info("Starting development server...")
{:ok, _} =
Application.ensure_all_started([
:telemetry,
:plug,
:thousand_island,
:bandit
])
{:ok, pid} = SloaneSH.serve() {:ok, pid} = SloaneSH.serve()
unless iex_running?() do unless iex_running?() do

View file

@ -6,6 +6,7 @@ defmodule Mix.Tasks.Site.Watch do
@impl Mix.Task @impl Mix.Task
def run(_args) do def run(_args) do
Mix.Task.run("app.start")
Logger.info("Starting site.watch...") Logger.info("Starting site.watch...")
{:ok, pid} = SloaneSH.watch() {:ok, pid} = SloaneSH.watch()