GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages
KUTIL_LOG(3) FreeBSD Library Functions Manual KUTIL_LOG(3)

kutil_err, kutil_errx, kutil_info, kutil_log, kutil_logx, kutil_verr, kutil_verrx, kutil_vinfo, kutil_vlog, kutil_vlogx, kutil_vwarn, kutil_vwarnx, kutil_warn, kutil_warnx
format log messages

library “libkcgi”

#include <sys/types.h>
#include <stdarg.h>
#include <stdint.h>
#include <kcgi.h>

void
kutil_err(const struct kreq *r, const char *ident, const char *fmt, ...);

void
kutil_errx(const struct kreq *r, const char *ident, const char *fmt, ...);

void
kutil_info(const struct kreq *r, const char *ident, const char *fmt, ...);

void
kutil_log(const struct kreq *r, const char *level, const char *ident, const char *fmt, ...);

void
kutil_logx(const struct kreq *r, const char *level, const char *ident, const char *fmt, ...);

void
kutil_verr(const struct kreq *r, const char *ident, const char *fmt, va_list ap);

void
kutil_verrx(const struct kreq *r, const char *ident, const char *fmt, va_list ap);

void
kutil_vinfo(const struct kreq *r, const char *ident, const char *fmt, va_list ap);

void
kutil_vlog(const struct kreq *r, const char *level, const char *ident, const char *fmt, va_list ap);

void
kutil_vlogx(const struct kreq *r, const char *level, const char *ident, const char *fmt, va_list ap);

void
kutil_vwarn(const struct kreq *r, const char *ident, const char *fmt, va_list ap);

void
kutil_vwarnx(const struct kreq *r, const char *ident, const char *fmt, va_list ap);

void
kutil_warn(const struct kreq *r, const char *ident, const char *fmt, ...);

void
kutil_warnx(const struct kreq *r, const char *ident, const char *fmt, ...);

These functions consistently format and output messages on standard error. See kutil_openlog(3) for configuring an alternative log destination.

These functions accept the following variables:

const struct kreq *r
Active request handle opened with khttp_parse(3). If NULL, the remote host field will be omitted.
const char *level
A human-readable log level. If NULL, no level is printed. For functions not accepting this argument, the INFO, WARN, and ERROR values are used for the informational, warning, and error functions, respectively.
const char *ident
The client identity of the caller. This adheres to the common CGI practise of connecting a message to a logged-in user. If NULL, no ident is printed.
const char *fmt
The printf(3) style format string for the variable argument or argument list following. This formats the log message. If NULL, no message is printed.

The kutil_err(), kutil_errx(), kutil_verr(), and kutil_verrx() functions exit with EXIT_FAILURE. They never return.

The log messages are filtered on output: non-printable (see isprint(3)) characters are replaced with “?” and space characters (\a, \b, \f, \n, \r, \t, \v, \0) are shown as literal escape characters.

The kutil_err(), kutil_verr(), kutil_log(), kutil_vlog(), kutil_vwarn(), and kutil_warn() functions print out the current errno following the log message.

The output format is as follows, with a trailing newline:

addr ident [date] level msg
addr ident [date] level msg: errmsg

Here, “addr” is the remote host as passed to the CGI script or “-” if r is NULL; and where “ident” “level” and “msg”, if NULL, will be rendered as “-”. The date is formatted as an HTTP date (RFC 822) in GMT.

These functions were written by Kristaps Dzonsons <kristaps@bsd.lv>.
June 12, 2022 FreeBSD 13.1-RELEASE

Search for    or go to Top of page |  Section 3 |  Main Index

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with ManDoc.