Skip to content

Commit

Permalink
improve get_log_file
Browse files Browse the repository at this point in the history
  • Loading branch information
ali96343 committed Oct 27, 2023
1 parent 827bb13 commit ef32e91
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions py4web/server_adapters.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@
# export PY4WEB_LOGS=/tmp # export PY4WEB_LOGS=
def get_log_file(out_banner = True):
log_dir = os.environ.get("PY4WEB_LOGS", None)
log_file = os.path.join(log_dir, "server-py4web.log") if log_dir else None
if log_file and out_banner:
print(f"log_file: {log_file}")
return log_file
if os.path.isdir(log_dir):
log_file = os.path.join (log_dir, 'server-py4web.log')
if out_banner:
print(f"log_file: {log_file}")
return log_file
return None


def check_level(level):
Expand Down

0 comments on commit ef32e91

Please sign in to comment.