summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2009-09-24 00:40:24 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2009-09-24 00:40:24 +0200
commit1a64e64694faba6783b1d05a193019f1ec241645 (patch)
tree18701b96d1c1c5aefb346961494af1422592191d /common
parent7ae9a74c9c3bdab619ac5c0cefe1c8269bb06603 (diff)
downloadeurephia-1a64e64694faba6783b1d05a193019f1ec241645.tar.gz
eurephia-1a64e64694faba6783b1d05a193019f1ec241645.tar.xz
eurephia-1a64e64694faba6783b1d05a193019f1ec241645.zip
Added missing header file and corrected doxygen errors
Diffstat (limited to 'common')
-rw-r--r--common/eurephia_log.c4
-rw-r--r--common/eurephia_log_struct.h93
2 files changed, 96 insertions, 1 deletions
diff --git a/common/eurephia_log.c b/common/eurephia_log.c
index ceff25f..baf63e7 100644
--- a/common/eurephia_log.c
+++ b/common/eurephia_log.c
@@ -161,7 +161,7 @@ pthread_mutex_t log_mutex = PTHREAD_MUTEX_INITIALIZER;
* @param log FILE pointer to a log file
* @param logdst Log destiation/priority
* @param loglvl Log level of the message
- * @param format stdarg, format string
+ * @param fmt stdarg, format string
* @param ap stdarg va_list, prepared by va_start()
*/
static void file_log(FILE *log, int logdst, int loglvl, const char *fmt, va_list ap) {
@@ -266,6 +266,8 @@ void eurephia_log_close(eurephiaCTX *ctx) {
* If it is "syslog:" it must continue with a string describing log facility such as
* "syslog:authpriv", "syslog:local0", "syslog:local1", "syslog:user", etc. If the
* facility is unknown, it will default to "user"
+ * @param loglevel Sets the verbosity level for the log file. The higher number, the more information
+ * will be logged.
*
* @return Returns 1 on success, otherwise 0;
*/
diff --git a/common/eurephia_log_struct.h b/common/eurephia_log_struct.h
new file mode 100644
index 0000000..babd5d2
--- /dev/null
+++ b/common/eurephia_log_struct.h
@@ -0,0 +1,93 @@
+/* eurephia_log.h -- eurephia log struct definition
+ *
+ * GPLv2 only - Copyright (C) 2009
+ * David Sommerseth <dazo@users.sourceforge.net>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; version 2
+ * of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+/**
+ * @file eurephia_log_struct.h
+ * @author David Sommerseth <dazo@users.sourceforge.net>
+ * @date 2009-09-23
+ *
+ * @brief Defines the eurphia log structure
+ *
+ */
+
+#ifndef EUREPHIA_LOG_STRUCT_H
+#define EUREPHIA_LOG_STRUCT_H
+
+#include <syslog.h>
+
+/*
+ * A lot of these definitions are here to make sure LOG_* definitions will not
+ * collide with syslog definitions.
+ *
+ */
+
+#ifndef LOG_INFO
+#define LOG_INFO 101 /**< Informational messages. Log level should be < 5 */
+#endif
+
+#ifndef LOG_DEBUG
+#define LOG_DEBUG 102 /**< Messages intended when debugging. Only for log level > 10 */
+#endif
+
+#ifndef LOG_WARNING
+#define LOG_WARNING 103 /**< Input data or processing revealed unexpected data. Log level never > 2*/
+#endif
+
+#ifndef LOG_ERR
+#define LOG_ERR 104 /**< Alias for LOG_ERROR, in case it is not defined */
+#endif
+#define LOG_ERROR LOG_ERR /**< API errors but not sever, program can continue to run */
+
+#ifndef LOG_CRIT
+#define LOG_CRIT 105 /**< Alias for LOG_CRITICAL */
+#endif
+#define LOG_CRITICAL LOG_CRIT /**< Operation failed and might have been aborted. Log level always 0 */
+
+#ifndef LOG_ALERT
+#define LOG_ALERT 106 /**< Alias for LOG_FATAL */
+#endif
+#define LOG_FATAL LOG_ALERT /**< Operation failed and cannot continue. Log level always < 2 */
+
+#ifndef LOG_EMERG
+#define LOG_EMERG 107 /**< Alias for LOG_PANIC */
+#endif
+#define LOG_PANIC LOG_EMERG /**< Action failed an program could not continue to run. Log level always 0 */
+
+
+/**
+ * Defines the different valid log types / logging backends
+ */
+typedef enum { logFILE, /**< Log to file */
+ logSYSLOG /**< Log via syslog */
+} eurephiaLOGTYPE;
+
+/**
+ * eurephia log context. Defines how the logging will be done when using eurephia_log()
+ */
+typedef struct {
+ eurephiaLOGTYPE logtype; /**< Defines which log backend to use */
+ unsigned int opened; /**< Boolean flag, if the logging is openend and enabled */
+ char *destination; /**< String containing log destination info (filename, syslog facility) */
+ FILE *logfile; /**< File pointer to the log file if logtype == logFILE */
+ int loglevel; /**< Defines the log verbosity, higher number increases log verbosity */
+} eurephiaLOG;
+
+#endif