Skip to content

Commit

Permalink
style: add logging for url port and host (#304)
Browse files Browse the repository at this point in the history
* style: add logging for url port and host

* test: improve test for allowing both robyn.env and positional parameter
  • Loading branch information
sansyrox authored Nov 5, 2022
1 parent 29696f2 commit 003ceb3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 1 addition & 3 deletions integration_tests/base_routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ async def redirect_route(request):


if __name__ == "__main__":
ROBYN_URL = os.getenv("ROBYN_URL", "0.0.0.0")
ROBYN_PORT = int(os.getenv("ROBYN_PORT", "5000"))
app.add_header("server", "robyn")
current_file_path = pathlib.Path(__file__).parent.resolve()
app.add_directory(
Expand All @@ -206,4 +204,4 @@ async def redirect_route(request):
index_file="index.html",
)
app.startup_handler(startup_handler)
app.start(port=ROBYN_PORT, url=ROBYN_URL)
app.start(port=5000)
5 changes: 4 additions & 1 deletion robyn/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ def start(self, url: str = "127.0.0.1", port: int = 5000):
url = os.getenv("ROBYN_URL", url)
port = int(os.getenv("ROBYN_PORT", port))

logger.info(
"%sStarting server at %s:%s %s", Colors.OKGREEN, url, port, Colors.ENDC
)

def init_processpool(socket):

process_pool = []
Expand Down Expand Up @@ -158,7 +162,6 @@ def init_processpool(socket):

process_pool = init_processpool(socket)

logger.info(f"{Colors.HEADER}Starting up \n{Colors.ENDC}")
logger.info(f"{Colors.OKGREEN}Press Ctrl + C to stop \n{Colors.ENDC}")
try:
for process in process_pool:
Expand Down

0 comments on commit 003ceb3

Please sign in to comment.