Replaced clixon_get_logflags() with clixon_logflags_get()

Added `clixon_logflags_set()`
This commit is contained in:
Olof hagsand 2024-08-16 10:31:52 +02:00
parent 39fb149756
commit 1709537701
5 changed files with 36 additions and 18 deletions

View file

@ -68,19 +68,25 @@ enum clixon_log_type{
#define clixon_log(h, l, _fmt, args...) clixon_log_fn((h), 1, (l), NULL, _fmt , ##args)
#define clixon_log_xml(h, l, x, _fmt, args...) clixon_log_fn((h), 1, (l), x, _fmt , ##args)
// COMPAT_7_1
#define clixon_get_logflags() clixon_logflags_get()
/*
* Prototypes
*/
char *clixon_logdst_key2str(int keyword);
int clixon_logdst_str2key(char *str);
int clixon_log_init(clixon_handle h, char *ident, int upto, int flags);
int clixon_log_exit(void);
int clixon_log_opt(char c);
int clixon_log_file(char *filename);
int clixon_log_string_limit_set(size_t sz);
size_t clixon_log_string_limit_get(void);
int clixon_get_logflags(void);
int clixon_log_str(int level, char *msg);
int clixon_log_fn(clixon_handle h, int user, int level, cxobj *x, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
char *clixon_logdst_key2str(int keyword);
int clixon_logdst_str2key(char *str);
int clixon_log_init(clixon_handle h, char *ident, int upto, uint16_t flags);
int clixon_log_exit(void);
int clixon_log_opt(char c);
int clixon_log_file(char *filename);
int clixon_log_string_limit_set(size_t sz);
size_t clixon_log_string_limit_get(void);
uint16_t clixon_logflags_get(void);
int clixon_logflags_set(uint16_t flags);
int clixon_log_str(int level, char *msg);
int clixon_log_fn(clixon_handle h, int user, int level, cxobj *x, const char *format, ...) __attribute__ ((format (printf, 5, 6)));
#endif /* _CLIXON_LOG_H_ */

View file

@ -80,7 +80,7 @@
static clixon_handle _log_clixon_h = NULL;
/* Bitmask whether to log to syslog or stderr: CLIXON_LOG_STDERR | CLIXON_LOG_SYSLOG */
static int _log_flags = 0x0;
static uint16_t _log_flags = 0x0;
/* Set to open file to write debug messages directly to file */
static FILE *_log_file = NULL;
@ -148,7 +148,7 @@ int
clixon_log_init(clixon_handle h,
char *ident,
int upto,
int flags)
uint16_t flags)
{
_log_clixon_h = h;
_log_flags = flags;
@ -222,12 +222,23 @@ clixon_log_file(char *filename)
return 0;
}
int
clixon_get_logflags(void)
/*! Get log flags
*/
uint16_t
clixon_logflags_get(void)
{
return _log_flags;
}
/*! Replace log flags
*/
int
clixon_logflags_set(uint16_t flags)
{
_log_flags = flags;
return 0;
}
/*! Truncate log/debug string length
*/
int