63 const uint64_t sleep = c_sleep_time *
S_TO_MS;
64 if ((
LastError == 0) || (elapsed >= sleep))
89 const char *
function,
enum LogLevel level, ...)
92 if (level > c_debug_level)
99 const char *fmt = va_arg(ap,
const char *);
100 int rc = vsnprintf(buf,
sizeof(buf), fmt, ap);
103 if ((level ==
LL_PERROR) && (rc >= 0) && (rc <
sizeof(buf)))
105 char *buf2 = buf + rc;
106 int len =
sizeof(buf) - rc;
107 const char *p = strerror(errno);
109 p =
_(
"unknown error");
111 rc += snprintf(buf2, len,
": %s (errno = %d)", p, errno);
114 const bool dupe = (strcmp(buf,
ErrorBuf) == 0);
118 log_disp_file(stamp, file, line,
function, level,
"%s", buf);
177 snprintf(ver,
sizeof(ver),
"-%s%s", PACKAGE_VERSION,
GitVer);
254 if (c_debug_level < 1)
274 intptr_t value,
struct Buffer *err)
276 if ((value < 0) || (value >=
LL_MAX))
size_t mutt_buffer_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
int mutt_buffer_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
static const char * mutt_buffer_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Color and attribute parsing.
ColorId
List of all colored objects.
@ MT_COLOR_MESSAGE
Informational message.
@ MT_COLOR_ERROR
Error message.
@ MT_COLOR_NORMAL
Plain text.
@ MT_COLOR_WARNING
Warning messages.
short cs_subset_number(const struct ConfigSubset *sub, const char *name)
Get a number config item by name.
const char * cs_subset_path(const struct ConfigSubset *sub, const char *name)
Get a path config item by name.
Convenience wrapper for the config headers.
Convenience wrapper for the core headers.
void mutt_refresh(void)
Force a refresh of the screen.
void mutt_simple_format(char *buf, size_t buflen, int min_width, int max_width, enum FormatJustify justify, char pad_char, const char *s, size_t n, bool arboreal)
Format a string, like snprintf()
void mutt_beep(bool force)
Irritate the user.
@ JUSTIFY_LEFT
Left justify the text.
void mutt_date_sleep_ms(size_t ms)
Sleep for milliseconds.
uint64_t mutt_date_epoch_ms(void)
Return the number of milliseconds since the Unix epoch.
const char * mutt_file_rotate(const char *path, int count)
Rotate a set of numbered files.
int level_validator(const struct ConfigSet *cs, const struct ConfigDef *cdef, intptr_t value, struct Buffer *err)
Validate the "debug_level" config variable - Implements ConfigDef::validator() -.
int log_disp_file(time_t stamp, const char *file, int line, const char *function, enum LogLevel level,...)
Save a log line to a file - Implements log_dispatcher_t -.
int log_disp_curses(time_t stamp, const char *file, int line, const char *function, enum LogLevel level,...)
Display a log line in the message line - Implements log_dispatcher_t -.
int log_disp_queue(time_t stamp, const char *file, int line, const char *function, enum LogLevel level,...)
Save a log line to an internal queue - Implements log_dispatcher_t -.
#define mutt_debug(LEVEL,...)
int main_log_observer(struct NotifyCallback *nc)
Notification that a Config Variable has changed - Implements observer_t -.
Convenience wrapper for the gui headers.
int log_file_set_level(enum LogLevel level, bool verbose)
Set the logging level.
bool log_file_running(void)
Is the log file running?
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.
LogLevel
Names for the Logging Levels.
@ LL_PERROR
Log perror (using errno)
@ LL_DEBUG5
Log at debug level 5.
@ LL_MESSAGE
Log informational message.
void msgwin_set_text(enum ColorId cid, const char *text)
Set the text for the Message Window.
size_t msgwin_get_width(void)
Get the width of the Message Window.
struct MuttWindow * msgwin_get_window(void)
Get the Message Window pointer.
void msgwin_clear_text(void)
Clear the text in the Message Window.
Convenience wrapper for the library headers.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
Hundreds of global variables to back the user variables.
bool ErrorBufMessage
true if the last message was an error
char ErrorBuf[256]
Copy of the last error message.
const int NumOfLogs
How many log files to rotate.
int mutt_log_set_level(enum LogLevel level, bool verbose)
Change the logging level.
int mutt_log_set_file(const char *file)
Change the logging file.
uint64_t LastError
Time of the last error message (in milliseconds since the Unix epoch)
void mutt_log_stop(void)
Close the log file.
int mutt_log_start(void)
Enable file logging.
static void error_pause(void)
Wait for an error message to be read.
void mutt_log_prep(void)
Prepare to log.
char * CurrentFile
The previous log file name.
void mutt_clear_error(void)
Clear the message line (bottom line of screen)
void window_redraw(struct MuttWindow *win)
Reflow, recalc and repaint a tree of Windows.
void mutt_buffer_expand_path(struct Buffer *buf)
Create the canonical path.
Some miscellaneous functions.
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
Handling of global boolean variables.
bool OptKeepQuiet
(pseudo) shut up the message and refresh functions while we are executing an external program
bool OptNoCurses
(pseudo) when sending in batch mode
bool OptMsgErr
(pseudo) used by mutt_error/mutt_message
void mutt_buffer_pool_release(struct Buffer **pbuf)
Free a Buffer from the pool.
struct Buffer * mutt_buffer_pool_get(void)
Get a Buffer from the pool.
#define CSR_ERR_INVALID
Value hasn't been set.
#define CSR_SUCCESS
Action completed successfully.
String manipulation buffer.
const char * name
User-visible name.
Container for lots of config items.
const char * name
Name of config item that changed.
Container for Accounts, Notifications.
struct ConfigSubset * sub
Inherited config items.
Data passed to a notification function.
void * event_data
Data from notify_send()
enum NotifyType event_type
Send: Event type, e.g. NT_ACCOUNT.
int cs_subset_str_native_set(const struct ConfigSubset *sub, const char *name, intptr_t value, struct Buffer *err)
Natively set the value of a string config item.
int cs_subset_str_string_set(const struct ConfigSubset *sub, const char *name, const char *value, struct Buffer *err)
Set a config item by string.