NetSurf
|
#include <stdarg.h>
#include <stdio.h>
#include "utils/config.h"
#include "utils/nsoption.h"
#include "utils/sys_time.h"
#include "utils/utsname.h"
#include "desktop/version.h"
#include "utils/log.h"
Go to the source code of this file.
Functions | |
static int | timeval_subtract (struct timeval *result, struct timeval *x, struct timeval *y) |
Subtract the ‘struct timeval’ values X and Y. More... | |
static const char * | nslog_gettime (void) |
Obtain a formatted string suitable for prepending to a log message. More... | |
void | nslog_log (const char *file, const char *func, int ln, const char *format,...) |
nserror | nslog_set_filter (const char *filter) |
Set the logging filter. More... | |
nserror | nslog_init (nslog_ensure_t *ensure, int *pargc, char **argv) |
Initialise the logging system. More... | |
nserror | nslog_set_filter_by_options (void) |
Set the logging filter according to the options. More... | |
void | nslog_finalise (void) |
Shut down the logging system. More... | |
Variables | |
bool | verbose_log = false |
flag to enable verbose logging More... | |
static FILE * | logfile |
The stream to which logging is sent. More... | |
void nslog_finalise | ( | void | ) |
Shut down the logging system.
Shuts down the logging subsystem, resetting to verbose logging and output to stderr. Note, if logging is done after calling this, it will be sent to stderr without filtering.
Definition at line 299 of file log.c.
References logfile, NSLOG, and verbose_log.
Referenced by main(), nsgtk_finalise(), and WinMain().
|
static |
Obtain a formatted string suitable for prepending to a log message.
Definition at line 72 of file log.c.
References timerisset, and timeval_subtract().
Referenced by nslog_log().
nserror nslog_init | ( | nslog_ensure_t * | ensure, |
int * | pargc, | ||
char ** | argv | ||
) |
Initialise the logging system.
Sets up everything required for logging. Processes the argv passed to remove the -v switch for verbose logging. If necessary ensures the output file handle is available.
Definition at line 190 of file log.c.
References logfile, utsname::machine, netsurf_version, utsname::nodename, NSERROR_INIT_FAILED, NSERROR_NOT_FOUND, NSERROR_OK, NSLOG, nslog_set_filter(), utsname::release, utsname::sysname, uname(), verbose_log, and utsname::version.
Referenced by gui_init_replicant(), main(), nsgtk_init(), and WinMain().
void nslog_log | ( | const char * | file, |
const char * | func, | ||
int | ln, | ||
const char * | format, | ||
... | |||
) |
Definition at line 157 of file log.c.
References logfile, nslog_gettime(), and verbose_log.
nserror nslog_set_filter | ( | const char * | filter | ) |
Set the logging filter.
Compiles and enables the given logging filter.
Definition at line 181 of file log.c.
References NSERROR_OK.
Referenced by nslog_init(), and nslog_set_filter_by_options().
nserror nslog_set_filter_by_options | ( | void | ) |
Set the logging filter according to the options.
Definition at line 289 of file log.c.
References nslog_set_filter(), nsoption_charp, and verbose_log.
Referenced by nsoption_validate().
|
static |
Subtract the ‘struct timeval’ values X and Y.
result | The timeval structure to store the result in |
x | The first value |
y | The second value |
Definition at line 44 of file log.c.
References result.
Referenced by nslog_gettime().
|
static |
The stream to which logging is sent.
Definition at line 34 of file log.c.
Referenced by nslog_finalise(), nslog_init(), and nslog_log().
bool verbose_log = false |
flag to enable verbose logging
Definition at line 31 of file log.c.
Referenced by deskmenu_update(), main(), menu_vlog(), nslog_finalise(), nslog_init(), nslog_log(), nslog_set_filter_by_options(), and plot_init().