'\" t
.\" Title: upscli_upslog_set_debug_level
.\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author]
.\" Generator: DocBook XSL Stylesheets vsnapshot
.\" Date: 04/07/2026
.\" Manual: NUT Manual
.\" Source: Network UPS Tools 2.8.5
.\" Language: English
.\"
.TH "UPSCLI_UPSLOG_SET_DE" "3" "04/07/2026" "Network UPS Tools 2\&.8\&.5" "NUT Manual"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
upscli_upslog_set_debug_level, upscli_upslog_get_debug_level, upscli_upslog_cookie, upscli_upslog_setprocname, upscli_upslog_setproctag, upscli_upslog_getproctag, upscli_upslog_start_sync \- manipulate the possibly separate (identified via cookie) copies of the `nut_debug_level` and sub\-process tag variables in the `libupsclient` build
.SH "SYNOPSIS"
.sp
.nf
#include
const void *upscli_upslog_cookie(void);
void upscli_set_debug_level(int, const void *cookie);
int upscli_get_debug_level(void);
void upscli_setprocname(const char *full_procname, const void *cookie);
void upscli_setproctag(const char *tag, const void *cookie);
const char *upscli_getproctag(void);
struct timeval *upscli_upslog_start_sync(struct timeval *tv, const void *cookie);
.fi
.SH "DESCRIPTION"
.sp
On some platforms, \fIlibupsclient\fR builds tend to get a built\-in copy of the internal code from NUT \fIlibcommon\fR library, so for NUT client programs using both libraries as dynamically\-linked shared code, the nut_debug_level setting is backed by independent variables in active memory, and upsdebugx() calls suffer if the library\(cqs copy is never changed from zero\&.
.sp
It can get even more confusing with libnutprivate\-common being a shared dynamically loaded library instance behind both the program and libupsclient, hence the cookies: direct NUT\-common code consumers like NUT in\-tree clients can use their nut_common_cookie() value to pass into methods here\&. Third\-party clients may safely pass \fINULL\fR\&.
.sp
These methods allow to set or retrieve the value of nut_debug_level setting known by the \fIlibupsclient\fR library, regardless of build mode\&.
.sp
The most likely use (at least in NUT programs) is to call upscli_set_debug_level(nut_debug_level); after changing the original variable\&. Values of the debugging level are zero to disable debug, may be negative for a few special cases, and generally are positive numbers to cut off the more verbose logging attempts; otherwise it is up to the code base and NUT style guide practices to assign certain levels to some classes of messages\&.
.sp
If internal upslog_start value is not yet set, we can set it with \fBupscli_upslog_start_sync()\fR from *tv (or current time if tv==NULL), otherwise the method is no\-op (keep and report the original setting)\&.
.sp
Returns the pointer to the currently set value, so it can be propagated or used in difftime() computations\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBNote\fR
.ps -1
.br
.sp
In WIN32 builds also enforces line\-buffering for stdout and stderr streams\&.
.sp .5v
.RE
.SH "RETURN VALUE"
.sp
There is no return value for the setter\&.
.sp
The getter returns the current value of the internal variable\&.
.SH "SEE ALSO"
.sp
\fBupscli_init\fR(3), \fBupscli_report_build_details\fR(3)