23#ifndef MUTT_MUTT_LOGGING2_H
24#define MUTT_MUTT_LOGGING2_H
32#define LOG_LINE_MAX_LEN 10240
69typedef int (*
log_dispatcher_t)(time_t stamp,
const char *file,
int line,
const char *function,
enum LogLevel level,
const char *format, ...)
70__attribute__((__format__(__printf__, 6, 7)));
89#define mutt_debug(LEVEL, ...) MuttLogger(0, __FILE__, __LINE__, __func__, LEVEL, __VA_ARGS__)
90#define mutt_warning(...) MuttLogger(0, __FILE__, __LINE__, __func__, LL_WARNING, __VA_ARGS__)
91#define mutt_message(...) MuttLogger(0, __FILE__, __LINE__, __func__, LL_MESSAGE, __VA_ARGS__)
92#define mutt_error(...) MuttLogger(0, __FILE__, __LINE__, __func__, LL_ERROR, __VA_ARGS__)
93#define mutt_perror(...) MuttLogger(0, __FILE__, __LINE__, __func__, LL_PERROR, __VA_ARGS__)
96#define log_multiline(LEVEL, STRING) log_multiline_full(LEVEL, STRING, __FILE__, __LINE__, __func__)
98int log_disp_file (time_t stamp,
const char *file,
int line,
const char *function,
enum LogLevel level,
const char *format, ...)
99 __attribute__((__format__(__printf__, 6, 7)));
100int log_disp_queue (time_t stamp, const
char *file,
int line, const
char *function, enum
LogLevel level, const
char *format, ...)
101 __attribute__((__format__(__printf__, 6, 7)));
103 __attribute__((__format__(__printf__, 6, 7)));
int log_file_open(bool verbose)
Start logging to a file.
void log_queue_empty(void)
Free the contents of the queue.
int log_disp_file(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...) __attribute__((__format__(__printf__
int(* log_dispatcher_t)(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...) __attribute__((__format__(__printf__
void log_queue_set_max_size(int size)
Set a upper limit for the queue length.
int int log_disp_queue(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...) __attribute__((__format__(__printf__
int log_file_set_level(enum LogLevel level, bool verbose)
Set the logging level.
bool log_file_running(void)
Is the log file running?
int int int log_disp_terminal(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...) __attribute__((__format__(__printf__
int(*) log_dispatcher_ MuttLogger)
void log_multiline_full(enum LogLevel level, const char *str, const char *file, int line, const char *func)
Helper to dump multiline text to the log.
void log_queue_flush(log_dispatcher_t disp)
Replay the log queue.
int int int int log_queue_add(struct LogLine *ll)
Add a LogLine to the queue.
LogLevel
Names for the Logging Levels.
@ LL_DEBUG4
Log at debug level 4.
@ LL_DEBUG3
Log at debug level 3.
@ LL_PERROR
Log perror (using errno)
@ LL_DEBUG5
Log at debug level 5.
@ LL_MESSAGE
Log informational message.
@ LL_DEBUG2
Log at debug level 2.
@ LL_DEBUG1
Log at debug level 1.
@ LL_NOTIFY
Log of notifications.
int log_queue_save(FILE *fp)
Save the contents of the queue to a temporary file.
void log_file_close(bool verbose)
Close the log file.
int log_file_set_filename(const char *file, bool verbose)
Set the filename for the log.
void log_file_set_version(const char *version)
Set the program's version number.
#define STAILQ_HEAD(name, type)
const char * file
Source file.
char * message
Message to be logged.
const char * function
C function.
int line
Line number in source file.
STAILQ_ENTRY(LogLine) entries
Linked list.
enum LogLevel level
Log level, e.g. LL_DEBUG1.
time_t time
Timestamp of the message.