diff options
Diffstat (limited to 'man3/nxt_unit_log.3')
-rw-r--r-- | man3/nxt_unit_log.3 | 91 |
1 files changed, 91 insertions, 0 deletions
diff --git a/man3/nxt_unit_log.3 b/man3/nxt_unit_log.3 new file mode 100644 index 000000000..8c310d358 --- /dev/null +++ b/man3/nxt_unit_log.3 @@ -0,0 +1,91 @@ +.\" (C) 2023, NGINX, Inc. +.\" +.TH nxt_unit_log 3 (date) "NGINX Unit (unreleased)" +.SH Name +nxt_unit_log, nxt_unit_alert, nxt_unit_error, nxt_unit_warn, nxt_unit_debug +\- print messages to the debug log +.SH Library +NGINX Unit library +.RI ( libunit ", " -lunit ) +.SH Synopsis +.nf +.B #include <nxt_unit.h> +.PP +.B enum { +.B " NXT_UNIT_LOG_ALERT," +.B " NXT_UNIT_LOG_ERR," +.B " NXT_UNIT_LOG_WARN," +.B " NXT_UNIT_LOG_NOTICE," +.B " NXT_UNIT_LOG_INFO," +.B " NXT_UNIT_LOG_DEBUG," +.B }; +.PP +.B [[gnu::format(printf, 3, 4)]] +.BI "void nxt_unit_log(nxt_unit_ctx_t *_Nullable " ctx ", int " level , +.BI " const char *" fmt ", ...);" +.PP +.BI "#define nxt_unit_alert(" ctx ", " fmt ", ...) \fR/* ... */\fP" +.BI "#define nxt_unit_error(" ctx ", " fmt ", ...) \fR/* ... */\fP" +.BI "#define nxt_unit_warn(" ctx ", " fmt ", ...) \fR/* ... */\fP" +.BI "#define nxt_unit_debug(" ctx ", " fmt ", ...) \fR/* ... */\fP" +.fi +.SH Arguments +.TP +.I ctx +Thread or main context object. +See +.MR nxt_unit_init 3 +and +.MR nxt_unit_ctx_alloc 3 . +If NULL is passed, +the output will be printed to standard error. +.TP +.I level +Log level (see the +.IR enum ). +.TP +.I fmt +See +.MR snprintf 3 . +.SH Description +.MR nxt_unit_log 3 +writes a formatted string into the Unit debug log, +prefixed with information about the application, +and appended by a new-line character. +.PP +The macros are just wrappers around +.MR nxt_unit_log 3 +that pass a specific log level. +.SH Return value +None. +.SH Errors +If these functions fail to write to the Unit debug log, +they will fall back to standard error. +.SH Files +.TP +.I /usr/local/var/log/unit/unit.log +Unit debug log. +See +.MR unitd 8 . +.SH Examples +See +.MR nxt_unit_init 3 . +.SH Copyright +(C) 2017-2023, NGINX, Inc. +.PP +SPDX-License-Identifier: Apache-2.0 +.SH See also +.MR nxt_unit_req_log 3 , +.MR unitd 8 . +.PP +.UR https://unit.nginx.org +Website +.UE +.PP +.UR https://mailman.nginx.org/mailman/listinfo/unit +Mailing list +.UE +.PP +.UR https://github.com/nginx/unit +GitHub +.UE |