]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Recognize DEBUG level of CGROUP_LOGLEVEL variable in daemon
authorPeter Schiffer <pschiffe@redhat.com>
Tue, 2 Apr 2013 08:55:33 +0000 (10:55 +0200)
committerIvana Hutarova Varekova <varekova@redhat.com>
Tue, 2 Apr 2013 08:55:33 +0000 (10:55 +0200)
If CGROUP_LOGLEVEL=DEBUG environment variable is set, enable --debug
verbosity
level in the cgrulesengd daemon.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
src/daemon/cgrulesengd.c

index 72ff9a94679ea1431756acf6c79415df9519671c..bc327d0f2f635970d975ae06eecfdf64670c29ec 100644 (file)
@@ -1027,6 +1027,18 @@ int main(int argc, char *argv[])
                goto finished;
        }
 
+       /*
+        * Check environment variable CGROUP_LOGLEVEL. If it's set to DEBUG,
+        * set appropriate verbosity level.
+        */
+       char *level_str = getenv("CGROUP_LOGLEVEL");
+       if (level_str != NULL) {
+               if (cgroup_parse_log_level_str(level_str) == CGROUP_LOG_DEBUG) {
+                       verbosity = 4;
+                       logp = "-";
+               }
+       }
+
        while (1) {
                int c;