#include "config.h"
#include <errno.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "core/lib.h"
#include "gui/lib.h"
#include "mutt_logging.h"
#include "color/lib.h"
#include "globals.h"
#include "muttlib.h"
Go to the source code of this file.
Macros | |
#define | S_TO_MS 1000L |
Functions | |
static void | error_pause (void) |
Wait for an error message to be read. | |
void | mutt_clear_error (void) |
Clear the message line (bottom line of screen) | |
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 -. | |
void | mutt_log_prep (void) |
Prepare to log. | |
void | mutt_log_stop (void) |
Close the log file. | |
int | mutt_log_set_file (const char *file) |
Change the logging file. | |
int | mutt_log_set_level (enum LogLevel level, bool verbose) |
Change the logging level. | |
int | mutt_log_start (void) |
Enable file logging. | |
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 | main_log_observer (struct NotifyCallback *nc) |
Notification that a Config Variable has changed - Implements observer_t -. | |
Variables | |
static uint64_t | LastError = 0 |
Time of the last error message (in milliseconds since the Unix epoch) | |
static char * | CurrentFile = NULL |
The previous log file name. | |
static const int | NumOfLogs = 5 |
How many log files to rotate. | |
NeoMutt Logging.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
Definition in file mutt_logging.c.
#define S_TO_MS 1000L |
Definition at line 52 of file mutt_logging.c.
|
static |
Wait for an error message to be read.
If '$sleep_time' seconds hasn't elapsed since LastError, then wait
Definition at line 59 of file mutt_logging.c.
void mutt_clear_error | ( | void | ) |
Clear the message line (bottom line of screen)
Definition at line 74 of file mutt_logging.c.
void mutt_log_prep | ( | void | ) |
Prepare to log.
Definition at line 171 of file mutt_logging.c.
void mutt_log_stop | ( | void | ) |
Close the log file.
Definition at line 181 of file mutt_logging.c.
int mutt_log_set_file | ( | const char * | file | ) |
Change the logging file.
file | Name to use |
0 | Success, file opened |
-1 | Error, see errno |
Close the old log, rotate the new logs and open the new log.
Definition at line 195 of file mutt_logging.c.
int mutt_log_set_level | ( | enum LogLevel | level, |
bool | verbose | ||
) |
Change the logging level.
level | Logging level |
verbose | If true, then log the event |
0 | Success |
-1 | Error, level is out of range |
Definition at line 226 of file mutt_logging.c.
int mutt_log_start | ( | void | ) |
Enable file logging.
0 | Success, or already running |
-1 | Failed to start |
This also handles file rotation.
Definition at line 248 of file mutt_logging.c.
|
static |
Time of the last error message (in milliseconds since the Unix epoch)
Definition at line 47 of file mutt_logging.c.
|
static |
The previous log file name.
Definition at line 49 of file mutt_logging.c.
|
static |
How many log files to rotate.
Definition at line 50 of file mutt_logging.c.