Home of logprintf.
More...
#include "log.h"
#include "conf.h"
#include "debug.h"
#include "ndata.h"
Go to the source code of this file.
|
| static int | slogprintf (FILE *stream, int newline, const char *str, size_t n) |
| | va_list version of logprintf and backend.
|
| static int | vlogprintf (FILE *stream, int newline, const char *fmt, va_list ap) |
| | va_list version of logprintf and backend.
|
| static void | log_copy (int enable) |
| | Sets up or terminates copying of standard streams into memory.
|
| static void | log_append (const FILE *stream, const char *str) |
| | Appends a message to a stream's in-memory buffer.
|
| static void | log_cleanStream (PHYSFS_File **file, const char *fname, const char *filedouble) |
| static void | log_purge (void) |
| | Deletes copied output without printing the contents.
|
| int | logprintf (FILE *stream, int newline, const char *fmt,...) |
| | Like fprintf, but automatically teed to log files (and line-terminated if newline is true).
|
| void | log_redirect (void) |
| | Sets up redirection of stdout and stderr to files. PhysicsFS must be initialized for this to work.
|
| void | log_init (void) |
| | Sets up the logging subsystem. (Calling this ensures logging output is preserved until we have a place to save it. That happens after we set up PhysicsFS and call log_redirect().)
|
| void | log_clean (void) |
| | Deletes useless (empty) log files from the current session.
|
| int | log_warn (const char *file, size_t line, const char *func, const char *fmt,...) |
| | Prints warnings, but skips if they are repeated too much.
|
Home of logprintf.
Definition in file log.c.
◆ log_append()
| void log_append |
( |
const FILE * | stream, |
|
|
const char * | str ) |
|
static |
Appends a message to a stream's in-memory buffer.
- Parameters
-
| stream | Destination stream (stdout or stderr) |
| str | String to append. |
Definition at line 263 of file log.c.
◆ log_clean()
Deletes useless (empty) log files from the current session.
Definition at line 228 of file log.c.
◆ log_cleanStream()
| void log_cleanStream |
( |
PHYSFS_File ** | file, |
|
|
const char * | fname, |
|
|
const char * | filedouble ) |
|
static |
◆ log_copy()
| void log_copy |
( |
int | enable | ) |
|
|
static |
Sets up or terminates copying of standard streams into memory.
While copying is active, all stdout and stderr-bound messages that pass through logprintf will also be put into a buffer in memory, to be flushed when copying is disabled.
- Parameters
-
| enable | Whether to enable or disable copying. Disabling flushes logs. |
Definition at line 179 of file log.c.
◆ log_init()
Sets up the logging subsystem. (Calling this ensures logging output is preserved until we have a place to save it. That happens after we set up PhysicsFS and call log_redirect().)
- See also
- log_copy
Definition at line 164 of file log.c.
◆ log_purge()
Deletes copied output without printing the contents.
Definition at line 211 of file log.c.
◆ log_redirect()
| void log_redirect |
( |
void | | ) |
|
Sets up redirection of stdout and stderr to files. PhysicsFS must be initialized for this to work.
Definition at line 130 of file log.c.
◆ log_warn()
| int log_warn |
( |
const char * | file, |
|
|
size_t | line, |
|
|
const char * | func, |
|
|
const char * | fmt, |
|
|
| ... ) |
Prints warnings, but skips if they are repeated too much.
Definition at line 299 of file log.c.
◆ logprintf()
| int logprintf |
( |
FILE * | stream, |
|
|
int | newline, |
|
|
const char * | fmt, |
|
|
| ... ) |
Like fprintf, but automatically teed to log files (and line-terminated if newline is true).
Definition at line 116 of file log.c.
◆ slogprintf()
| int slogprintf |
( |
FILE * | stream, |
|
|
int | newline, |
|
|
const char * | str, |
|
|
size_t | n ) |
|
static |
va_list version of logprintf and backend.
Definition at line 59 of file log.c.
◆ vlogprintf()
| int vlogprintf |
( |
FILE * | stream, |
|
|
int | newline, |
|
|
const char * | fmt, |
|
|
va_list | ap ) |
|
static |
va_list version of logprintf and backend.
Definition at line 87 of file log.c.
◆ copying
Definition at line 39 of file log.c.
◆ errcopy
Definition at line 26 of file log.c.
◆ errfiledouble
| char* errfiledouble = NULL |
|
static |
Definition at line 36 of file log.c.
◆ logerr_file
| PHYSFS_File* logerr_file = NULL |
|
static |
Definition at line 43 of file log.c.
◆ logout_file
| PHYSFS_File* logout_file = NULL |
|
static |
Definition at line 42 of file log.c.
◆ merrcopy
Definition at line 29 of file log.c.
◆ moutcopy
Definition at line 28 of file log.c.
◆ nerrcopy
Definition at line 32 of file log.c.
◆ noutcopy
Definition at line 31 of file log.c.
◆ outcopy
< Temporary storage buffers.
Definition at line 25 of file log.c.
◆ outfiledouble
| char* outfiledouble = NULL |
|
static |
< Output filenames for stdout and stderr.
Definition at line 35 of file log.c.