Skip to content
Jurek Muszyński edited this page Dec 18, 2021 · 4 revisions

void ALWAYS(const char *str[, ...])

void ERR(const char *str[, ...])

void WAR(const char *str[, ...])

void INF(const char *str[, ...])

void DBG(const char *str[, ...])

Description

Writes str to log, depending on log level set in conf file. Optionally it takes additional arguments, as per printf function family specification.

ALWAYS - if log level > 0
ERR - only if log level >= 1, writes ERROR: before string
WAR - only if log level >= 2, writes WARNING: before string
INF - only if log level >= 3
DBG - only if log level >= 4

If logLevel is > 0, then log file is created on every start in $NPP_DIR/logs, or — if there's no logs directory — in the current directory. File name contains date and time: YYYYMMDD_HHmm.log or — if test=1 in config — YYYYMMDD_HHmm_t.log. Every midnight new log file is started.

If logToStdout is set to 1, no log file is created and all writes go to stdout instead.

By default every request is logged in Common Log Format. If logCombined is set to 1, Combined Log Format is used, which additionally prints Referer and User-Agent.

If log level is set to 4, besides the standard log lines, there's quite a lot of information logged, including full request and response HTTP headers, and every call flushes the buffer straight away, to help in investigation in case of a crash. Buffer is also flushed after every ERR write.

Returns

None

Example

ALWAYS("Server is starting");
DBG("in a while loop, i = %d", i);
Clone this wiki locally