]> git.ipfire.org Git - thirdparty/libcgroup.git/commitdiff
Enabled default logging
authorPeter Schiffer <pschiffe@redhat.com>
Tue, 2 Apr 2013 08:54:24 +0000 (10:54 +0200)
committerIvana Hutarova Varekova <varekova@redhat.com>
Tue, 2 Apr 2013 08:54:24 +0000 (10:54 +0200)
Default target of log messages is stdout and ERRORs are sent there by
default.

This is quite a change from the behavior of previous versions - no logging
was sent anywhere unless --enable-debug was specified at ./configure time.

Signed-off-by: Peter Schiffer <pschiffe@redhat.com>
Acked-by: Ivana Hutarova Varekova <varekova@redhat.com>
include/libcgroup/init.h
include/libcgroup/log.h
src/api.c

index 3709096541a6b93f18a165695e72b63da9f6cac6..5150f2fc38eb7aea344190bdc32ba92c823b687c 100644 (file)
@@ -35,6 +35,10 @@ __BEGIN_DECLS
 /**
  * Initialize libcgroup. Information about mounted hierarchies are examined
  * and cached internally (just what's mounted where, not the groups themselves).
+ *
+ * If the cgroup logging was not set using cgroup_set_logger() or
+ * cgroup_set_default_logger() before calling cgroup_init(), the default logger
+ * is automatically set, logging CGROUP_LOG_ERROR messages.
  */
 int cgroup_init(void);
 
index d504ae33e90c2f704e7132c6a249c87fdf172835..356eefb8327b41467b52ddaa29ce23efbbfe9f5c 100644 (file)
@@ -29,6 +29,8 @@ __BEGIN_DECLS
  * @par
  * The logging callback can be set at any time, but setting the callback before
  * any other libcgroup function (including cgroup_init()) is highly recommended.
+ * If no logger is set before cgroup_init() is called, default logger is
+ * automatically set, logging CGROUP_LOG_ERROR messages to stdout.
  *
  * @par Setting log level
  * Some of the functions below set the log level as integer.
index 2851efd0c38c2682132d1a485fa38d1e52e13870..43acd32da7733cbf0fa4bb9c3b7be856e92a6b78 100644 (file)
--- a/src/api.c
+++ b/src/api.c
@@ -854,6 +854,8 @@ int cgroup_init(void)
        char mntent_buffer[4 * FILENAME_MAX];
        char *strtok_buffer = NULL;
 
+       cgroup_set_default_logger(-1);
+
        pthread_rwlock_wrlock(&cg_mount_table_lock);
 
        /* free global variables filled by previous cgroup_init() */