68 return snprintf(buf, buflen,
"<%c>",
LevelAbbr[level + 3]);
74int log_disp_debug(time_t stamp,
const char *file,
int line,
const char *function,
75 enum LogLevel level,
const char *format, ...)
78 size_t buflen =
sizeof(buf);
101 bytes += snprintf(buf + bytes, buflen - bytes,
"\033[1;%dm", colour);
112 bytes +=
log_level(buf + bytes, buflen - bytes, level);
116 va_start(ap, format);
117 bytes += vsnprintf(buf + bytes, buflen - bytes, format, ap);
121 bytes += snprintf(buf + bytes, buflen - bytes,
": %s", strerror(err));
125 bytes += snprintf(buf + bytes, buflen - bytes,
"\033[0m");
129 bytes += snprintf(buf + bytes, buflen - bytes,
"\n");
bool DebugLogLevel
Prefix log level, e.g. [E].
static int log_level(char *buf, size_t buflen, enum LogLevel level)
Write a log level to a buffer.
bool DebugLogColor
Output ANSI colours.
static int log_timestamp(char *buf, size_t buflen, time_t time)
Write a timestamp to a buffer.
bool DebugLogTimestamp
Show the timestamp.
const char * LevelAbbr
Abbreviations of logging level names.
int log_disp_debug(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...)
Display a log line on screen - Implements log_dispatcher_t -.
LogLevel
Names for the Logging Levels.
@ LL_PERROR
Log perror (using errno)
@ LL_MESSAGE
Log informational message.
@ LL_DEBUG1
Log at debug level 1.
#define LOG_LINE_MAX_LEN
Log lines longer than this will be truncated.
size_t mutt_date_localtime_format(char *buf, size_t buflen, const char *format, time_t t)
Format localtime.
Convenience wrapper for the library headers.