Skip to content
This repository has been archived by the owner on Oct 31, 2024. It is now read-only.

Commit

Permalink
verion 0.1.8 allow it to be serialzied from other threads
Browse files Browse the repository at this point in the history
  • Loading branch information
mdipierro committed Jan 2, 2022
2 parents 32256e6 + 8b319ef commit 14f65ce
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ Launch Arguments
[default: lazy]
--ssl_cert PATH SSL certificate file for HTTPS
--ssl_key PATH SSL key file for HTTPS
--errorlog TEXT Where to send error logs
(:stdout|:stderr|tickets_only|{filename})
[default: :stderr]
-help, -h, --help Show this message and exit.
Expand Down
4 changes: 3 additions & 1 deletion docs/chapter-03.rst
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,6 @@ running it without any argument

# py4web

.. FIXME: next image must be updated

.. image:: images/command.png
:class: with-shadow
Expand Down Expand Up @@ -370,6 +369,9 @@ This currently gives an error on binaries installations and from source installa

--ssl_cert PATH SSL certificate file for HTTPS
--ssl_key PATH SSL key file for HTTPS
--errorlog TEXT Where to send error logs
(:stdout|:stderr|tickets_only|{filename})
[default: :stderr]
-help, -h, --help Show this message and exit.


Expand Down
18 changes: 12 additions & 6 deletions py4web/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1008,15 +1008,17 @@ def get_error_snapshot(depth=5):
"""Return a dict describing a given traceback (based on cgitb.text)."""

tb = traceback.format_exc()
logfile = os.environ.get("PY4WEB_LOGFILE")
if logfile:
errorlog = os.environ.get("PY4WEB_ERRORLOG")
if errorlog:
msg = f"[{datetime.datetime.now().isoformat()}]: {tb}\n"
if logfile == ':stderr':
if errorlog == ':stderr':
sys.stderr.write(msg)
elif logfile == ':stdout':
elif errorlog == ':stdout':
sys.stdout.write(msg)
elif errorlog == 'tickets_only':
pass
else:
with portalocker.Lock(logfile, "a", timeout=2) as fp:
with portalocker.Lock(errorlog, "a", timeout=2) as fp:
fp.write(msg)

etype, evalue, etb = sys.exc_info()
Expand Down Expand Up @@ -1895,7 +1897,11 @@ def new_app(apps_folder, app_name, yes, scaffold_zip):
"--ssl_cert", type=click.Path(exists=True), help="SSL certificate file for HTTPS"
)
@click.option("--ssl_key", type=click.Path(exists=True), help="SSL key file for HTTPS")
@click.option("--logfile", default="", help="Where to send error logs (:stdout/:stderr/{filename})")
@click.option("--errorlog",
default=":stderr",
help="Where to send error logs (:stdout|:stderr|tickets_only|{filename})",
show_default=True,
)
def run(**kwargs):
"""Run all the applications on apps_folder"""
install_args(kwargs)
Expand Down

0 comments on commit 14f65ce

Please sign in to comment.