From: Tom Hromatka Date: Mon, 13 Jan 2025 18:17:13 +0000 (-0700) Subject: api: log: Add cgroup_get_loglevel() X-Git-Tag: v3.2.0~20 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d0becd6c53781d4233a3f82b7b9faa8d5108a606;p=thirdparty%2Flibcgroup.git api: log: Add cgroup_get_loglevel() Add a publicly-exposed function to get the current libcgroup logging level. Signed-off-by: Tom Hromatka Acked-by: Kamalesh Babulal --- diff --git a/include/libcgroup/log.h b/include/libcgroup/log.h index b65b8d39..19152a45 100644 --- a/include/libcgroup/log.h +++ b/include/libcgroup/log.h @@ -132,6 +132,12 @@ extern void cgroup_set_default_logger(int loglevel); */ extern void cgroup_set_loglevel(int loglevel); +/** + * Retrieve the current loglevel. + * @return the current loglevel from with libcgroup + */ +extern int cgroup_get_loglevel(void); + /** * Libcgroup log function. This is for applications which are too lazy to set * up their own complex logging and miss-use libcgroup for that purpose. diff --git a/src/libcgroup.map b/src/libcgroup.map index bf1d2ed7..4ab5e752 100644 --- a/src/libcgroup.map +++ b/src/libcgroup.map @@ -168,4 +168,5 @@ CGROUP_3.0 { CGROUP_3.2 { cgroup_get_threads; + cgroup_get_loglevel; } CGROUP_3.0; diff --git a/src/log.c b/src/log.c index c9bc8260..4154d82b 100644 --- a/src/log.c +++ b/src/log.c @@ -90,3 +90,8 @@ void cgroup_set_loglevel(int loglevel) cgroup_loglevel = CGRP_DEFAULT_LOGLEVEL; } } + +int cgroup_get_loglevel(void) +{ + return cgroup_loglevel; +}