Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mod_log_config: Add log_formatter support and a JSON log_formatter #429

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions include/httpd.h
Original file line number Diff line number Diff line change
Expand Up @@ -1968,6 +1968,38 @@ AP_DECLARE(char *) ap_escape_html2(apr_pool_t *p, const char *s, int toasc)
AP_DECLARE(char *) ap_escape_logitem(apr_pool_t *p, const char *str)
AP_FN_ATTR_NONNULL((1));

/**
* Apply JSON escaping to a UTF string. Invalid UTF8 character sequences
* are replaced by the U+FFFD replacement character.
* @param dest The destination buffer, can be NULL
* @param src The original buffer
* @param srclen The length of the original buffer. Pass APR_ESCAPE_STRING
* for a NUL terminated string.
* @param quote If non zero, surround the string with quotes, and if the
* string is NULL, return the string "NULL".
* @param len If present, returns the length of the string
* @return APR_SUCCESS, or APR_NOTFOUND if the string resulted in no
* modification, APR_EINVAL if bad UTF8 is detected. In all cases valid
* UTF8 is returned.
*/
APR_DECLARE(apr_status_t) ap_escape_json(char *dest, const char *src,
apr_ssize_t srclen, int quote, apr_size_t *len);

/**
* Apply JSON escaping to a UTF string. Invalid UTF8 character sequences
* are replaced by the U+FFFD replacement character.
* @param p Pool to allocate from
* @param src The original buffer
* @param srclen The length of the original buffer. Pass APR_ESCAPE_STRING
* for a NUL terminated string.
* @param quote If non zero, surround the string with quotes, and if the
* string is NULL, return the string "NULL".
* @return A zero padded buffer allocated from the pool on success, or
* NULL if src was NULL.
*/
APR_DECLARE(const char *) ap_pescape_json(apr_pool_t *p, const char *src,
apr_ssize_t srclen, int quote);

/**
* Escape a string for logging into the error log (without a pool)
* @param dest The buffer to write to
Expand Down
Loading