libircbot
library providing a framework for implementing an IRC bot
Loading...
Searching...
No Matches
log.h
Go to the documentation of this file.
1#ifndef IRCBOT_LOG_H
2#define IRCBOT_LOG_H
3
4#include <ircbot/decl.h>
5
6#include <stdio.h>
7
16#define MAXLOGLINE 16384
21typedef enum IBLogLevel
22{
27 L_DEBUG
29
37typedef void (*IBLogWriter)(IBLogLevel level, const char *message, void *data)
38 ATTR_NONNULL((2));
39
44DECLEXPORT void IBLog_setFileLogger(FILE *file) ATTR_NONNULL((1));
45
52DECLEXPORT void IBLog_setSyslogLogger(const char *ident, int facility,
53 int withStderr) ATTR_NONNULL((1));
54
60DECLEXPORT void IBLog_setCustomLogger(IBLogWriter writer, void *data)
61 ATTR_NONNULL((1));
62
68DECLEXPORT void IBLog_setMaxLogLevel(IBLogLevel level);
69
76DECLEXPORT void IBLog_setSilent(int silent);
77
87DECLEXPORT void IBLog_setAsync(int async);
88
94DECLEXPORT void IBLog_msg(IBLogLevel level, const char *message)
95 ATTR_NONNULL((2));
96
103DECLEXPORT void IBLog_fmt(IBLogLevel level, const char *format, ...)
104 ATTR_NONNULL((2)) ATTR_FORMAT((printf, 2, 3));
105
106#endif
107
void IBLog_setCustomLogger(IBLogWriter writer, void *data)
Set a custom log writer.
void IBLog_msg(IBLogLevel level, const char *message)
Log a message.
void IBLog_setMaxLogLevel(IBLogLevel level)
Set the maximum level for logging.
void IBLog_setFileLogger(FILE *file)
Set a log writer logging to the specified file handle.
void IBLog_fmt(IBLogLevel level, const char *format,...)
Log a message, using printf-like formatting.
void IBLog_setSyslogLogger(const char *ident, int facility, int withStderr)
Set a log writer logging via syslog().
void IBLog_setSilent(int silent)
Silence all logging.
void IBLog_setAsync(int async)
Enable async logging.
Common preprocessor declarations for libircbot.
void(* IBLogWriter)(IBLogLevel level, const char *message, void *data)
A log writer.
Definition: log.h:37
IBLogLevel
Logging level log.h <ircbot/log.h>
Definition: log.h:22
@ L_FATAL
program execution can't continue
Definition: log.h:23
@ L_ERROR
an error message, can't successfully complete
Definition: log.h:24
@ L_WARNING
a warning message, something seems wrong
Definition: log.h:25
@ L_DEBUG
a debugging message, very verbose
Definition: log.h:27
@ L_INFO
an information message
Definition: log.h:26