ns_asynclogfile - Manage connection channels.
The command ns_asynclogfile can be used to write application specific log file entries in an asynchronous fashion. It is based on the same infrastructure as the system log (see ns_log) or the access log (see ns_accesslog). This command is designed for small write operations in a multi-threaded environment, where potentially multiple writers perform concurrent operations.
The command ns_asynclogfile open opens a write-only log file and returns a thread-shareable handle (actually a numeric file descriptor) which can be used in subsequent ns_asynclogfile write or ns_asynclogfile close operations.
The specified filename names the file to be opened, the optional mode is a list of entries limited to APPEND, EXCL, DSYNC, SYNC, TRUNC. The modes DSYNC and SYNC are only allowed, when supported by the used operating systems. For details on the meaning of these flags, consult the open manual page of section (2) of standard Unix manuals.
Write the provided line to an opened logfile denoted by the handle. If the line should be terminated by a new-line character, the caller has to provide this character. The option -binary should be provided for binary data. The optional parameter -sanitize can be used to sanitize the input. The default is taken from the global parameter sanitizelogfiles.
The value of 0 means that no sanitize should happen.
The value 1 means that full sanitizing is in place, which means that non-printable characters are written as hex values.
The a sanitize value of 2 means that sanitizing happens in a human friendly fashion: newlines are preserved, but sanitizing makes sure that multiline content cannot not confused with different log file entries. After a new-line character a continuation character starts the new line followed by 4 spaces.
Close the logfile.