summaryrefslogtreecommitdiffstats
path: root/cgrulesengd.h
diff options
context:
space:
mode:
authorDhaval Giani <dhaval@linux.vnet.ibm.com>2009-02-12 16:01:07 +0000
committerDhaval Giani <dhaval@linux.vnet.ibm.com>2009-02-12 16:01:07 +0000
commita97281cee1d0326868a016dc491bf210bcccfca4 (patch)
tree2d89815e13d66373521b9c9e0fa57abe61ae0f20 /cgrulesengd.h
parent589b9f8fd74995b75e63bd8113322f545898c80d (diff)
downloadlibcg-a97281cee1d0326868a016dc491bf210bcccfca4.tar.gz
libcg-a97281cee1d0326868a016dc491bf210bcccfca4.tar.xz
libcg-a97281cee1d0326868a016dc491bf210bcccfca4.zip
libcgroup: Send log message to a log file, to syslog or to both.
From: Jan Safranek <jsafrane@redhat.com> Rework whole cgrulesengd logging to be able to send log messages to syslog. Also introduce more log levels: LOG_NOTICE is the default log level, it logs startup/shutdown/configuration reload and errors. LOG_INFO shows in addition content of configuration file (only if logging to file is enabled) and changing cgroup of a PID. LOG_DEBUG show all details as it was before the patch. TODO: if something gets wrong with mounted hierarchies (e.g. root unmounts them), the log gets full of "Cgroup change for PID: ... FAILED". Some suppression should be implemented. Signed-off-by: Jan Safranek <jsafrane@redhat.com> Acked-by: Dhaval Giani <dhaval@linux.vnet.ibm.com> git-svn-id: https://libcg.svn.sourceforge.net/svnroot/libcg/trunk@319 4f4bb910-9a46-0410-90c8-c897d4f1cd53
Diffstat (limited to 'cgrulesengd.h')
-rw-r--r--cgrulesengd.h18
1 files changed, 10 insertions, 8 deletions
diff --git a/cgrulesengd.h b/cgrulesengd.h
index bdffd31..5c5d2a5 100644
--- a/cgrulesengd.h
+++ b/cgrulesengd.h
@@ -65,13 +65,14 @@ __BEGIN_DECLS
void cgre_usage(FILE *fd, const char *msg, ...);
/**
- * Prints a formatted message (like printf()) to a file stream, and flushes
- * the file stream's buffer so that the message is immediately readable.
- * @param fd The file stream to write to
+ * Prints a formatted message (like printf()) to all log destinations.
+ * Flushes the file stream's buffer so that the message is immediately
+ * readable.
+ * @param level The log level (LOG_EMERG ... LOG_DEBUG)
* @param format The format for the message (printf style)
* @param ... Any args to format (printf style)
*/
-void flog(FILE* fd, const char* msg, ...);
+void flog(int level, const char *msg, ...);
/**
* Process an event from the kernel, and determine the correct UID/GID/PID to
@@ -96,13 +97,14 @@ int cgre_handle_message(struct cn_msg *cn_hdr);
* Turns this program into a daemon. In doing so, we fork() and kill the
* parent process. Note too that stdout, stdin, and stderr are closed in
* daemon mode, and a file descriptor for a log file is opened.
- * @param logp Path of the log file
+ * @param logp Path of the log file, NULL if no log file was specified
+ * @param logf Syslog facility, NULL if no facility was specified
* @param daemon False to turn off daemon mode (no fork, leave FDs open)
- * @param logs False to disable logging (no log FD, leave stdout open)
+ * @param logv Log verbosity, 2 is the default, 0 = no logging, 5 = everything
* @return 0 on success, > 0 on error
*/
-int cgre_start_daemon(const char *logp, const unsigned char daemon,
- const unsigned char logs);
+int cgre_start_daemon(const char *logp, const int logf,
+ const unsigned char daemon, const int logv);
/**
* Catch the SIGUSR2 signal and reload the rules configuration. This function