Skip to content

rewrite logging #18

@LeSpocky

Description

@LeSpocky

Currently there's libcgi_error() which is used in numerous places around the whole library. If the global variable cgi_display_errors contains true it prints HTML markup to stdout containing the error message. If the passed error code is E_FATAL or E_MEMORY (defined in src/error.h) it even calls cgi_end() and exit().

Besides the obvious sudden exit which may be bad (do we need this?) I consider it bad to print anything to stdout where my content should go to. The used HTML tags could be invalid if not printed at the right time or even break correct markup. (They do e.g. when using sessions if there's a session cookie but no session file.)

A flexible solution could work like in libabc or we could just print to stderr, which some webservers can append to their logfiles (others return HTTP status 500 or mix stdout/stderr and return it to the browser).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions