Skip to content

Commit

Permalink
#255 - Improve server log info
Browse files Browse the repository at this point in the history
  • Loading branch information
ellmetha committed Sep 18, 2024
1 parent 6fdf314 commit f7385e7
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/marten.cr
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ module Marten

Marten::Server.setup

Log.info { "Marten running on #{Marten::Server.addresses.join ", "} (Press CTRL+C to quit)" }
show_server_info

Signal::INT.trap do
Signal::INT.reset
Expand Down Expand Up @@ -300,4 +300,20 @@ module Marten
end
end
end

private def self.show_server_info : Nil
base_message = "Marten running on #{Marten::Server.addresses.join ", "} (Press CTRL+C to quit)"

if Marten.settings.debug?
Log.info {
String.build do |s|
s << "#{"=" * base_message.size}\n"
s << base_message
s << "\n#{"=" * base_message.size}"
end
}
else
Log.info { base_message }
end
end
end

0 comments on commit f7385e7

Please sign in to comment.