63 const uint64_t sleep = c_sleep_time *
S_TO_MS;
64 if ((
LastError == 0) || (elapsed >= sleep))
88int log_disp_curses(time_t stamp,
const char *file,
int line,
const char *function,
89 enum LogLevel level,
const char *format, ...)
92 if (level > c_debug_level)
99 int rc = vsnprintf(buf,
sizeof(buf), format, ap);
102 if ((level ==
LL_PERROR) && (rc >= 0) && (rc <
sizeof(buf)))
104 char *buf2 = buf + rc;
105 int len =
sizeof(buf) - rc;
106 const char *p = strerror(errno);
108 p =
_(
"unknown error");
110 rc += snprintf(buf2, len,
": %s (errno = %d)", p, errno);
117 log_disp_file(stamp, file, line, function, level,
"%s", buf);
173 char ver[64] = { 0 };
174 snprintf(ver,
sizeof(ver),
"-%s%s", PACKAGE_VERSION,
GitVer);
251 if (c_debug_level < 1)
271 intptr_t value,
struct Buffer *err)
273 if ((value < 0) || (value >=
LL_MAX))
275 buf_printf(err,
_(
"Invalid value for option %s: %ld"), cdef->
name, (
long) value);
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Color and attribute parsing.
ColorId
List of all coloured 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.
#define CSR_ERR_INVALID
Value hasn't been set.
#define CSR_SUCCESS
Action completed successfully.
Convenience wrapper for the core headers.
void mutt_refresh(void)
Force a refresh of the screen.
void mutt_beep(bool force)
Irritate the user.
const char * mutt_file_rotate(const char *path, int count)
Rotate a set of numbered files.
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
char ErrorBuf[1024]
Copy of the last error message.
bool OptMsgErr
(pseudo) used by mutt_error/mutt_message
bool ErrorBufMessage
true if the last message was an error
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_queue(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...)
Save a log line to an internal queue - Implements log_dispatcher_t -.
int log_disp_file(time_t stamp, const char *file, int line, const char *function, enum LogLevel level, const char *format,...)
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, const char *format,...)
Display a log line in the message line - 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.
LogLevel
Names for the Logging Levels.
@ LL_PERROR
Log perror (using errno)
@ LL_DEBUG5
Log at debug level 5.
@ LL_MESSAGE
Log informational message.
#define LOG_LINE_MAX_LEN
Log lines longer than this will be truncated.
void msgwin_clear_text(struct MuttWindow *win)
Clear the text in the Message Window.
struct MuttWindow * msgwin_get_window(void)
Get the Message Window pointer.
void msgwin_set_text(struct MuttWindow *win, const char *text, enum ColorId color)
Set the text for the Message Window.
uint64_t mutt_date_now_ms(void)
Return the number of milliseconds since the Unix epoch.
void mutt_date_sleep_ms(size_t ms)
Sleep for milliseconds.
Convenience wrapper for the library 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.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_str_copy(char *dest, const char *src, size_t dsize)
Copy a string into a buffer (guaranteeing NUL-termination)
char * mutt_str_replace(char **p, const char *s)
Replace one string with another.
static 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.
static 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.
static 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 buf_expand_path(struct Buffer *buf)
Create the canonical path.
Some miscellaneous functions.
@ NT_CONFIG
Config has changed, NotifyConfig, EventConfig.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
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.